Functions - Udf
Functions - Udf
Q1. Write a program to create a function to find the cube of a number. Write proper function calls.
Q18. WAP to print the first name, middle name and last name of a person.
Q24. WAP to create four different functions to perform all arithmetic operations. Call the functions
inside another function calc().
Q25. WAP to create four different functions to find the area of a circle, rectangle, circle and square. Call
the functions inside another function area().
Q26. WAP to create a calculator using functions and return multiple values.
Q27. WAP to input and return five numbers from the user. Return the numbers to the main program
and print them by: 1. Unpacking 2. Tuple indexing
Q.28) Write a python function that takes two numbers and find their product.
Q.29) Write a python function that takes two numbers and print the smaller number. Also write how to
call this function.
Q.30) Write a function INDEX_LIST(L), where L is the list of elements passed as argument to the function.
The function returns another list named ‘indexList’ that stores the indices of all Non-Zero Elements of L.
For example: If L contains [12,4,0,11,0,56]
The index List will have - [0,1,3,5]
Q.31) Write a function that receives two string arguments and checks whether they are same-length
strings (returns True in this case otherwise False).
Q.32) Write a function countNow(PLACES) in Python, that takes the dictionary, PLACES as an argument
and displays the names (in uppercase)of the places whose names are longer than 5 characters.
PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}
LONDON
NEW YORK
Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple containing
length of each word of a string. For example, if the string is "Come let us have some fun", the tuple will
have (4, 3, 2, 4, 4, 3)