In: Computer Science
What data type will Python pick for the following variable?
radio = '101.5'
A. |
integer (i.e. int) |
|
B. |
string (i.e. str) |
|
C. |
floating point number (i.e. float) |
|
D. |
list |
Which of the following Python statements changes the first element of a tuple my_tuple to 17?
A. |
my_tuple[0] = 17 |
|
B. |
my_tuple[0] == 17 |
|
C. |
both (A) and (B) |
|
D. |
none of the above |
Suppose there are two sections of CSC121 and each section has 10 students. Their midterm exam scores are stored in two lists score_list1 and score_list2. Which of the following Python program fragments displays all these midterm exam scores?
A. |
combined_list = [score_list1, score_list2] for element in combined_list: for score in element: print (score) |
|
B. |
combined_list = score_list1 + score_list2 for element in combined_list: print (element) |
|
C. |
both (A) and (B) |
|
D. |
none of the above |
def main():
age = float(input('Enter age: '))
# insert statement here to call the buffet_price function
print('Please pay $', price)
def buffet_price(age):
if age >= 60 or age <= 10:
price = 9
else:
price = 12
return price
main()
Which of the following statements should be used to call the buffet_price function?
A. |
buffet_price(price, age) |
|
B. |
buffet_price(age, price) |
|
C. |
price = buffet_price(age) |
|
D. |
age = buffet_price(price) |