PYTHON QUESTION 1 MULTIPLE CHOICE A.. A file that contains reusable code is called a: a. module c. function b. hierarchy chart d. namespace B. A global variable: a. is defined inside the main() function b. cannot be modified inside a function c. cannot be accessed from within a function d. is defined outside of all functions
PYTHON
QUESTION 1 MULTIPLE CHOICE
A.. A file that contains reusable code is called a:
a. |
module |
c. |
function |
b. |
hierarchy chart |
d. |
namespace |
B. A global variable:
a. |
is defined inside the main() function |
b. |
cannot be modified inside a function |
c. |
cannot be accessed from within a function |
d. |
is defined outside of all functions |
C. A return statement:
a. |
must be coded within every function |
b. |
can be used to return a local variable to the calling function |
c. |
can be used to allow the function to modify the value of a global variable |
d. |
can only be used once in each function |
Code Example 4-1
def get_username(first, last):
s = first + "." + last
return s.lower()
def main():
first_name = input("Enter your first name: ")
last_name = input("Enter your last name: ")
username = get_username(first_name, last_name)
print("Your username is: " + username)
main()
D. Refer to Code Example 4-1: If the user enters ‘Lopez’ for the first prompt in main() and ‘Maria’ for the second prompt, what will display?
a. |
Maria.Lopez |
b. |
maria.lopez |
c. |
lopez.maria |
d. |
Lopez.Maria |

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









