Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

8. what is output by the code below? temp = 19 if temp >= 212: print(\b…

Question

  1. what is output by the code below?

temp = 19
if temp >= 212:
print(\boiling\)
elif temp <= 32:
print(\freezing\)

a. 19
b. true
c. boiling
d. freezing
e. there is no output.

  1. what is output by the code below?

x = 250
width = 50
print(\moving right\)
if x + width > 800:
print(\hit edge\)

a. moving right
b. hit edge
c. true
d. false
e. moving right hit edge

  1. what is output by the code below?

score = 200
highscore = 310
if score > highscore:
print(\you beat the high score by\, score - highscore, \points!\)
else:
print(\you needed\, highscore - score, \points\)

a. you beat the high score by 110 points!
b. you needed 110 points
c. 110
d. 310
e. 200

Explanation:

Step1: Analyze the condition in the code

In the code score = 200 and highScore = 310. The condition score > highScore is \(200>310\), which is false.

Step2: Execute the else - part

Since the condition is false, the else part of the code is executed. The calculation highScore - score is \(310 - 200=110\).

Answer:

b. You needed 110 points