Trace the Code
Loop Logic

If / Else Reasoning
Debug the Idea
Vocabulary & Concepts
100

x=3

x=x+2

print(x)

The answer is 5



The x is starting at 3 but then it goes to add 2 to it making the output to 5 

100

 How many times does “hi” print?

for i in range (3):

      Print(“hi”)

3



The loop is going to run one time for each number in the range 3 which will have the output to 3 

100

If it is raining, you bring an umbrella. Otherwise, you wear sunglasses.

It is raining. What should you do?

Bring an umbrella



Since it is raining, the if condition is true, so you should bring an umbrella.

100

what is wrong with the logic code 

for i in range (1,5):

   Print(i)

The loop does not include 5  


the programmer is going to think range (1,5) goes up to the number 5 but it stops before the second number 

100

What is a variable

 A place to store a value 


It’s going to hold information so the program can use it later 

200

X=10

y=x-4

x=y+1

print(x)

the answer is 7 


:

The y is going to become 6 then the x is going to reassigned to y +1 which then would equal to 7

200

What is printed?

total=0

for i in range (4):

      Total += i

print(total)

6



The loop will add 0,1,2 and then the total to 3 making the result 6

200

If your homework is finished, you can play video games. Otherwise, you must keep working.
Your homework is not finished. What should you do?

Keep working.



The if condition is false, so the else action happens

200

What is wrong with this logic code 

x=0

while x<5:

     Print(x)

What's wrong is that the loop is not going to stop 



The value x is never going to change, so the condition remains true forever, causing the loop to continue indefinitely.

200

What does a loop do

It repeats the code 



Loop run the same code multiple time without rewriting it 

300

a=5

b=a

a=a+3

print(b)

5



The b from the value of a is going to change not now but after then it will not change 

300


Count =0

for i in range(1,6):

   If i % 2 == 0:

         Count +=1
print(count)


2



Only even numbers 2 and the 4 will rise the count so its then increments twiceL

300

What is printed?   

X =8 

if x % 2==0:

     If x >10:

         Print(“big even”)

 Else:

       Print(“small”)

else:

     Print(“odd:)

The answer is small even 


Explanation:

The x is the even  but it not greater than 10 so the inner else runs 

300

What's wrong with the loop 

score=85

if score >90:

      Prints(“A”)

if score >80:

     Print(“b)

More than one grade can be printed 



If you're using two separate if statements, it allows it to multiply the condition to run when only one outcome should occur.

300

Difference between = and ==

= it sets the values    ==it going to compare the values 



One assigns data to the variable while the other one checks if two values are the same or equal.