What is one way to trace a loop correctly?
What is the value of the loop variable
Does the condition evaluate to true or false
What gets printed or changed
Give me one example in what a for loop is
A for loop repeats code a set number of times
It saves time and makes programs cleaner
Instead of copying the same line many times, we loop
Question 1 (Easy):
When using input in what scenario do you need to incorporate integer.
When you need the answer in numbers and not words
Age = 15
If age > 18:
print(“You are a teen”)\
What is wrong
The logic of the code is wrong
What is a string
text based date, denoted by quotation marks
For i in range(1,6)
If i > 3:
print(“Big)
Else:
Print (“Small”)
Given code what numbers will be printed false/small?
1,2,3
For i in range(5):
print(i)
What numbers are printed in the for loop code
0,1,2,3,4
age = 18
if (age >= 18):
print("You're an adult.")
else:
print("You're a minor.")
What does the code print out
You’re an adult
Pizza = input(“Do you want pizza (yes/no)”)
If pizza == “yes”:
print(“No pizza”)
Else:
print(“Yes pizza)
What is wrong?:
The logic of the code is wrong
What does an integer do
It turns inputs into whole number for the code not to be an error
for i in range(1,7):
if i % 2 == 0:
print("even")
else:
print("Odd")
Given code how many odd/false statements will there be
3 odd/false statements
For i in range(1,9):
If i>4:
print(“Big”)
Else:
print(“Small”)
Given this code how many times is “Big” printed
4 times
number = 7
if number % 2 == 0:
print("The number is even.")
else:
print("The number is odd.")
What does this code print out
The number is odd.
Dog = int(Input(“What is the dog doing”)
If Dog == “Playing” and Dog == “Tired”
print(“Let him get tired)
Else:
print(“Let him rest”)\
What is wrong?:
The code is wrong and the logic
What is a loop used for
A loop is used to repeat things