1.
Q1: Put the code in the right order to create a program that generates a random number between 0 and 10 as a global variable, and then calls a function that takes no arguments to print out the square and the cube of that variable.
calculate_celsius
that returns the temperature in Celsius given a temperature in Fahrenheit. This function can optionally round the temperature in Celsius. Prompt the user for a temperature in Fahrenheit, and then use the calculate_celsius
function to print out a message with the temperature in Celsius.DEFAULT_VALUE
, which is defined at the top of the program as a random number between -10 and 10. If DEFAULT_VALUE
is greater than 0, call the function with the values 3 and 5 and no third parameter and print out the result. Otherwise, call the function with the values 2 and 8 and the third parameter as 5, and print a message saying “Not using default value” and then print the result.6 * (3 + 2)
def sum(a, b):
return a + b
def multiply(a, b):
return a * b