Preview

05 - Predict the output challenges

 1. Look through this presentation and select 'Yes' when you have done so.

  True

  False

 2. Predicting the output involves carefully following the _______ of instructions to see what happens to the input.

  people

  letters

  sequence and order

  frightening bits

 3. The following code is contained in a python language function called 'chocolatebar'. Follow the logic to see how many bars (state a number) that Keziah is left with.
def chocolatebar():
  david=3
  jonathan=2
  keziah = 2
  keziah = david + jonathan
  david = 0
  print(keziah)

chocolatebar()

 4. Follow the logic in this code and predict the final value of z?
x=1
y=5
y= y - x
z=y+5
print(z) #What is the final value of z??

 5. Follow the logic in the following program and predict what will be output to the screen?
apples=3
oranges=3
if apples > 2:
  print("You have more than two apples")
else:
  print("You have less than two apples")

  You have zero apples

  You have more than two apples

  You have six apples

  You have less than two apples