Day 11 ------------ 1.Functions 2.Recursive Function and lambda Functions 3.Map,filter,reduce. Questions[Theory]: ----------------- 1.What is mean by functions in python? 2.What are the types of functions? 3.How will you declare the functions? 4.How many values it will return? 5.What is the use of * operator in python functions? 6.What is lambda function in Python? 7.What is a recursive function? 8.What is an anonymmous function? 9.What is differencce between filter() and map()? 10.What is reduce() and in which module it is present? 11.What is keyword used for function deceleration? 12.What is use of ** operator in python functions? 13.What is difference between * and ** functions? 14.Can we able to change value of global variable? Questions[Practical]: -------------------- QUESTION 1: ----------- QUESTION 1.1: ------------- Functions : emp_Id(),emp_Name(),emp_Dob(),emp_Phone(),emp_Email(),emp_Address() Description: Create the above functions without arguments QUESTION 1.2: ------------- Functions : greens_Omr(),greens_Adayar(),greens_Tambaram(),greens_Velacherry(),greens_Anna_Nagar() Description: Create the above functions with passing some arguments QUESTION 2: ----------- QUESTION 2.1: ------------- Functions : add(),sub() Description: Create the above function and pass two arguments and returntype of one value QUESTION 2.2: ------------- Functions : calculator() Description: Create the above function and pass two arguments and returntype of multiple values QUESTION 3: ----------- QUESTION 3.1: ------------- Description:Find the output for the below function def my_function(fname, lname): print(fname + " " + lname) my_function("Harry") QUESTION 3.2: ------------- Description:Find the output for the below function def my_function(country = "Norway"): print("I am from " + country) my_function("Sweden") my_function("India") my_function() my_function("Brazil") QUESTION 4: ----------- Functions : company_details(),employee_details() Description: Create the below functions with three arguments with the default return type QUESTION 5: ----------- Functions : details(),names() Description: Create the below functions with variable argument length QUESTION 6: ----------- QUESTION 6.1: ------------- Description:Find the output for the below code def computer_names(*names): print(names) computer_names(name1="hp",name2="sony",name3="dell") QUESTION 7: ----------- Arguments : country_name,area_covered,country_population,no_of_states,no_of_unionterritories Description: Create a function named as country_details and pass the above arguments print the values one by one QUESTION 8: ----------- QUESTION 8.1: ------------- Description: Create a recursive function of your own and print the word "Welcome" Output : -------- Welcome 1 . . . . QUESTION 8.2: ------------- Description:Create a recursive function of your own and print the word "python" upto 100 times Output : -------- python 1 . . . . python 99 QUESTION 8.3: ------------- Description:Write a program for factorial of 5 using recursion Output : -------- 120 QUESTION 9: ----------- QUESTION 9.1: ------------- Description: Using lambda function perform addition,subtraction and multiplication QUESTION 9.2: ------------- Description: Using lambda function perform cube of given number QUESTION 9.3: ------------- Description: Using lambda function check whether given number is odd or Even QUESTION 9.4: ------------- Description: Using lambda function perform squareroot of given number QUESTION 10: ------------ Description: Using filter print only the even numbers from the list Input : [1, 5, 4, 6, 8, 11, 3, 12] Output : [4, 6, 8, 12] QUESTION 11: ----------- Description: Using map write a program to double each item in a list Input :[2, 4, 8, 11, 24, 10, 3, 27] Output :[4, 8, 16, 22, 48, 20, 6, 54] QUESTION 12: ------------ QUESTION 12.1: -------------- Description:Using reduce write a program to add the numbers Input :[1,2,4,3] Output : -------- 10 QUESTION 12.2: -------------- Description:Using reduce write a program to multiply the numbers Input :[2,6,11,24,27] Output : -------- 85536