Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Unit 4 Quiz

1. What are modules?


A. They are files containing variables and functions that you
can import
B. They are square roots you can import
C. They are math functions you can import
2. What
A.
B.
C.

is the purpose of a parameter/argument?


They are required when defining/making a function
They act as input the user enters when running a function
They are limitations when making a variable

3. I cannot call another function while defining a function


A. True
B. False
4. All variables are part of a type (string, int, float etc etc).
A. True
B. False
5. A function can have more than one parameter/argument.
A. True
B. False

Unit 4 Exercises
Create a function that accepts three inputs and returns the largest of
the inputs. Dont forget to run the function after defining it and enter
numbers as the inputs! (Dont enter strings!)
Now, create a function that accepts three inputs and returns the
longest of the inputs. Dont forget to run the function after defining it
and enter strings as the inputs! (Hint: In this case, use len() to find the
longest string)
Using the python file as the base, have this function compare the
parameter/argument to a random variable generated in the base code.
If the argument entered is less than the random variable, print (Wrong
guess! The number is bigger.). If the argument entered is greater than
the random variable, print (Wrong guess! The number is smaller.). If
the argument entered is same as the random variable, print (Bingo!
You have guessed correctly!).

You might also like