Quiz 3 - Variables and Data Types
Which string definition results in an error? 'It is 10am' "It's 10am" 'It's 10am' "It is 10am"
'It's 10am'
Which variable name is valid in Python? 3blindmice $money account_balance
3blindmice
Which expression evaluates to 2? 5//3 5%3 2/2
5%3
Python treats all numbers the same, regardless of numerical value. True False
False
Which data type in Python represents a number with a decimal point? Float Frac Dec Int
Float
Which of these will not output: I'm learning a lot! print('I'm learning a lot!') message = "I'm learning a lot! print (message) print ("I'm learning a lot!")
print('I'm learning a lot!')
What operator do you use to assign a value to a variable? plus (+) equals (=) assign (&)
equals (=)
Which data type is a whole number? bool int str num
int
How would you fix the following code to return the remainder of 1,000 divided by 300? 1,000 / 300 1,000 // 300 1000 % 300 1000 ** 300 1,000 %% 300
1000 % 300
Although Python ignores empty lines, one place where whitespace does make a difference is inside of _____. Strings Functions Files
Strings
When would a removal of white space be problematic? removing an empty line between two lines of code? removing the space after the "if" in if x==1 removing the space after the string in print("Hi, " ,name) removing the spaces around the equal sign in x=1
removing the space after the "if" in if x==1
Which variable name is valid in Python? max distance break 1st_rule speed_limit
speed_limit
What will the following code print? variable = "12" print(type(variable)) int 12 twelve str
str