9ce598b13fa21ada1782db5dfb4702be python lab3 v3 rasb14 2018-09-22 08:57:24 v3.1.3 (2018-09-13)
Generated 2018-09-22 10:57:24 by dbwebb lab-utility v3.1.3 (2018-09-13).
In these exercises we will work with functions.
Create a function called greeter that returns "Hi, the weather is nice today!".
Answer with the return value from a call to the function.
Assign the words: ‘cake’ and ‘leek’ to two different variables.
Create a function and pass the two words as arguments to it. Your function should return them as a single word.
Answer with the result.
Create a function called funny_word that takes one argument and prepends it to the string ’ is a funny word’. EXAMPLE: If the argument is ‘water’, the function should return: "water is a funny word".
Use the argument ‘restaurant’ and answer with a call to the function.
Create a function called summation that takes two arguments. The function should return the sum of the two arguments.
Answer with the return value from a call to the function with the two arguments 49 and 92.
Create a function called multiplication that takes two arguments. The function should return the product of the two arguments.
Answer with the return value from a call to the function with the two arguments 49 and 92.
Create a function called in_range that takes one argument. The function should return True if the argument is higher than 50 and lower than 100. If the number is out of range, the function should return False. The return type should be boolean.
Use the argument 83 and answer with a call to the function.
Create a function called multiplicator. Inside the function create a loop that iterates from 5 to 21 (both included). For each number use the multiplication function from above to get the square of the current number. The function should return a comma-separated string of the squared numbers, without an ending ,.
Answer with a call to the function multiplicator.
Create a function called decider. The function takes one argument. If the argument is a string return a call to funny_word(), if the argument is an integer return the square of the argument by using the multiplication function.
Answer with a call to the function decider with the value 52 as argument.
Create a function called double_decider. The function takes two arguments. For each argument call the decider function. Concatenate the returned values in a string.
Separate the two values by ’ and the square is ‘.
Answer with a call to the function double_decider with the values: filibuster and 52 as arguments.
These questions are worth 3 points each. Solve them for extra points.
Create a function that returns a binary string value of a given integer. Return only the binary number and not any identification that it is a binary number.
Example: Calling the function with the number 3 should return "11".
Answer with a call to the function with the argument 83.
Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters. The function should return a string with the format “Lower case letters: #, upper case letters: #”. Only count letters, you can ignore space and special characters.
Answer with a call to the function with the argument: "Pack my Box with five dozen LiQuor juGs.".
9ce598b13fa21ada1782db5dfb4702be