Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

Learning Functions with Python Programming

Quiz yourself by thinking what should be in each of the black spaces below before clicking on it to display the answer.
        Help!  

Question
Answer
a named sequence of instructions that are grouped together to perform a task   function  
🗑
A function is useful because it allows the programmer to organize their code by breaking it down into smaller pieces?   True  
🗑
When a function is called, additional information may be needed called a(n)   argument  
🗑
A function that returns a value is called a   value returning function  
🗑
A function that does not return a value is called a   non-value retruning function  
🗑
In the following code what is the name of the function: def addName(name: str) -> None:   addName  
🗑
In the following code what is the parameter: def addName(name: str) -> None:   name  
🗑
In the following code what is returned by the function: def addName(name: str) -> None:   nothing (None)  
🗑
In the following code, how many parameters are there: def findMin(num1: int, num2: int, num3: int) -> int:   3 (num1, num2, num3)  
🗑
In the following code what data type is parameter 1: def findMin(num1: int, num2: int, num3: int) -> int:   int  
🗑
In the following code, what is returned by the function: def findMin(num1: int, num2: int, num3: int) -> int:   int  
🗑
What is the keyword used to define a function?   def  
🗑
What contains information about how a function will work and be called?   function header  
🗑
What receives and argument when the function is called?   parameter  
🗑
A function can have more then one return statement?   True (as long as only one return statement can be reached, such as an if/else structure)  
🗑
A function can return more then one value?   False  
🗑
The function header consists of the function identifier and arguments?   False  
🗑
The functions signature consists of the function identifier and arguments.   True  
🗑
The function header consists of the function identifier, list or formal parameters, and return type if denoted.   True  
🗑
In the following code what is the argument: addName("Jane")   Jane  
🗑
Write a function called averagePay that will return the average pay of type float of an employee over a number of weeks. The function should have 2 parameters totalPay of type float and numOfWeeks of type int. Include function annotations in your answer.   def averagePay(totalPay: float, numOfWeeks: int) -> float: return totalPay / numOfWeeks  
🗑
What is the function signature of the following function: def maxValue(pay1: float, pay2: float) -> float:   maxValue(float, float)  
🗑
What is the function signature of the following code: def sayHello() -> None:   sayHello()  
🗑
What are the function parameters of the following code: def sayHello() -> None:   no parameters  
🗑


   

Review the information in the table. When you are ready to quiz yourself you can hide individual columns or the entire table. Then you can click on the empty cells to reveal the answer. Try to recall what will be displayed before clicking the empty cell.
 
To hide a column, click on the column name.
 
To hide the entire table, click on the "Hide All" button.
 
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
 
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.

 
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how
Created by: dianarNW
Popular Computers sets