python list exercises code example

Example 1: python function exercises

Exercise 1: Create a function that can accept two arguments name and 
  age and print its value
Exercise 2: Write a function func1() such that it can accept a variable 
  length of  argument and print all arguments value
Exercise 3: Write a function calculation() such that it can accept two 
  variables and calculate the addition and subtraction of them. And a
  lso it must return both addition and subtraction in a single return 
  call
Exercise 4: Create a function showEmployee() in such a way that it 
  should accept employee name, and its salary and display both. 
  If the salary is missing in the function call assign default value 
  9000 to salary
Exercise 5: Create an inner function to calculate the addition in the 
  following way
Exercise 6: Write a recursive function to calculate the sum of numbers 
  from 0 to 10
Exercise 7: Assign a different name to function and call it through the 
  new name
Exercise 8: Generate a Python list of all the even numbers between 4 to 
  30
Exercise 9: Return the largest item from the given list
  
⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️ GOTO URL FOR PRACTICE ⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️
https://pynative.com/python-functions-exercise-with-solutions/

Example 2: Sample Input: ['a', 'b', ['c', ['d', 'e', ['f', 'g', 'h', 'i', 'j'], 'k'], 'l'], 'm', 'n'] Sample Output: [['c', ['d', 'e', ['f', 'g', 'h', 'i', 'j'], 'k'], 'l']]

print['a', 'b', ['c', ['d', 'e', ['f', 'g', 'h', 'i', 'j'], 'k'], 'l'], 'm', 'n']

Example 3: first_list = [10,20,30,40] second list = first list second list[3]=400

aList = [1, 2, 3, 4, 5, 6, 7]