Engineering 102 TAMU Final Exam
Questions and Answers 100% Solved
from my_funcs importy factorial - ✔✔my_funcs.py contains definitions for the factorial() and
squared() functions.
What statement imports only the factorial function from my_funcs.py?
def - ✔✔What keyword is used to define a function?
local; global - ✔✔A variable is defined in the context of just a particular function, while
a variable is defined throughout the program.
Howdy John - ✔✔Given the following code, what is the output?:
def howdy(name): print('Howdy', name) howdy('John')
return - ✔✔A function can return a value using what keyword?
pass in the data via the arguments/parameters - ✔✔The "right" way to access data from a
function is to:
value - ✔✔In a Python dictionary, for a given key, there is a single .
['soda', 'water'] - ✔✔What is the output for the following code?
drinks = ['soda','water','lemonade','orange juice'] favorite_drink = drinks[0:2]
print(favorite_drink)
Questions and Answers 100% Solved
from my_funcs importy factorial - ✔✔my_funcs.py contains definitions for the factorial() and
squared() functions.
What statement imports only the factorial function from my_funcs.py?
def - ✔✔What keyword is used to define a function?
local; global - ✔✔A variable is defined in the context of just a particular function, while
a variable is defined throughout the program.
Howdy John - ✔✔Given the following code, what is the output?:
def howdy(name): print('Howdy', name) howdy('John')
return - ✔✔A function can return a value using what keyword?
pass in the data via the arguments/parameters - ✔✔The "right" way to access data from a
function is to:
value - ✔✔In a Python dictionary, for a given key, there is a single .
['soda', 'water'] - ✔✔What is the output for the following code?
drinks = ['soda','water','lemonade','orange juice'] favorite_drink = drinks[0:2]
print(favorite_drink)