Test Your Understanding

1.13. Test Your Understanding#

Question 1

Which of these variables have valid names? Select all that apply.

lucky_number = 3
price($) = 2.78
4th_place = 'John'
sigma2 = 10
Question 2

What is the type of the variable x?

x = 3.3

integer

float

string

list

lock This solution is locked.
Question 3

What would you expect to be the output of the following code?

cost = '1.25'
quantity = 3
print('Total cost: ${}'.format(cost * quantity))
Total cost: $1.251.251.25
Total cost: $3.75
Traceback (most recent call last):
  File "main.py", line 3, in <module>
    print("Total cost: ${}".format(cost * quantity))
TypeError: can't multiply sequence by non-int of type 'str'
lock This solution is locked.
Question 4

What is the value of x?

x = 2**2 + 2
Solution

Solution is locked