IT 116: Introduction to Scripting
Class 16 Ungraded Quiz
-
What appears after
return
in a return
statement?
-
Name the four types of expressions.
-
Can a
return
statement return more than one value?
-
Write the SINGLE Python statement you would use to return the value of the expression interest *
principle from within a function.
-
Write the SINGLE Python statement you would use to return
True
if the parameter number_1
were greater than the parameter number_2, but otherwise return False
.
-
Write the SINGLE Python statement you would use to return
True
if the parameter number_1
were equal to the parameter number_2, but otherwise return False
.
-
Write a SINGLE Python statement to return
True
if the parameter number
were less than 0, but otherwise return False
.
-
Write the Python function get_positive which takes no parameter
and returns a number greater than 0. This function should use the
input
function
to ask the user for a number and convert it to an integer. It should then keep looping until it
gets a number that is greater than 0. When it gets such a number, it should return that number.