Questions
Conceptual
What is the resulting value and data type of the following expression?
int("20")What is the resulting value and data type of the following expression?
str(2023) + str(2023)What is the resulting value of the following expression?
type(9 / len( str(110))What is the resulting value of the following expression?
"440" + "20"What value of x would cause the following expression to evaluate to
True?(3 + x) == (55 % 2 ** 4)What value does the following expression result in, and what is its type?
2 + 2 / 2 ** (2 * 0)Using subscription syntax and concatenation, write an expression that evaluates to
"tar"using the following string:“Saturday".What data type do expressions with relational operators typically evaluate to?
What does the following expression evaluate to?
int("10" + "40") > 100 * 2What are the types of the following expressions and what values do they evaluate to? If an error would occur, just write
Error.10.1.
1.5 + 210.2.
"hehe" * 210.3.
len("110") ** 210.4.
str(110) * 2.110.5.
float("100.0") / 2010.6.
20 / 2 ** 2 + 310.7.
float("220") >= float("100" + "100")10.8.
int("COMP 110"[5]) + 99.010.9.
(42 % 4) == (79 % 11)10.10.
int(4.99)Which of the following expressions correctly concatenates two strings together?
"clam" * "chowder""clam" + "chowder""clam" , "chowder""clam" : "chowder"
When using subscription syntax, what index does Python start with?
-101""True
Use subscription notation, string concatenation, and the string
"nevermind"to write an expression that evaluates to"nvm".
Solutions
Conceptual Solutions
20,int"20232023",str<class 'float'>(Or justfloatis sufficient on a quiz.)"44020"44.0There are two possible answers:
"Saturday"[2] + "Saturday"[1] + "Saturday"[4]or
"Saturday"[2] + "Saturday"[6] + "Saturday"[4]boolTrue10.1. Type:
floatValue:3.510.2. Type:
strValue:"hehehehe"10.3. Type:
intValue:910.4.
TypeError10.5. Type:
floatValue:5.010.6. Type:
floatValue:8.010.7. Type:
boolValue:False10.8. Type:
floatValue:100.010.9. Type:
boolValue:True10.10. Type:
intValue:4B
B
"nevermind"[0] + "nevermind"[2] + "nevermind"[5]