D. Do the online reading: Overloading the plus operator
1. 11 + 22 evaluates to: HINT: enter error if it generates an error
ANS. 33
2. '11' + '22' evaluates to: HINT: enter error if it generates an error
ANS. '1122'
ANS. 1122
ANS. "1122"
3. '11' + str(3 + 3) + '22' evaluates to: HINT: enter error if it generates an error
ANS. '11622'
ANS. "11622"
ANS. 11622
4. '11' + 33 evaluates to: HINT: enter error if it generates an error
ANS. error
5. What does the statement print(x,y,z) print if x=1, y=2, and z=3?
a. 1, 2, 3
b. 1 2 3~
c. 6
d. 123
6. What does the statement print(str(x)+str(y)+str(z)) print if x=1, y=2, and z=3?
a. 1, 2, 3
b. 1 2 3
c. 6
d. 123~
7. What does the statement print(x+y+z) print if x=1, y=2, and z=3?
a. 1, 2, 3
b. 1 2 3
c. 6~
d. 123
8. Implement a function named print_equation that given two numbers x and y prints an equation for the sum of them (e.g., if x is 65 and y is 11, the function would print 65+11=76)
M. Line 1 -> def print_equation(x,y):
M. Line 2 -> print(str(x)+"+"+str(y)+"="str(x+y))
M. -> print(x,y,x+y)
M. -> print(x+++y+=+x+y)
M. -> print("65+11=76")
9. When is the upcoming exam (exam 2)?
a. Next Wednesday, 10/7~
b. Next Monday, 10/5
c. This Friday, 10/2
d. Monday after Fall Break, 10/12