For each of the first two questions, write out your best guess as to what the code will print. Clearly label this as your guess. Then run the code and look at the output. Write if your guess was correct. If it was not, briefly describe what was different and why.
Predicting what the code will do is important in writing programs, and figuring out why programs don't run the way expected.
x = 0 while x < 10: print(x) x = x + 2
x = 1 while x < 64: print(x) x = x * 2
x = 0 while x < 10 and x >= 0: print(x) x = x + 2
x = 5 while x >= 0: print(x) if x == "1": print("Blast off!") x = x - 1
x = float(input("Enter a number greater than zero: ")) while x <= 0: print("Too small. Enter a number greater than zero: ")
x = 10 while x < 0: print(x) x - 1 print("Blast-off")
i = 0 for i in range(10): print(i) i += 1
# Sample 1 x = 0 for i in range(10): x += 1 for j in range(10): x += 1 print(x) # Sample 2 x = 0 for i in range(10): x += 1 for j in range(10): x += 1 print(x)