# Hint: What is missing?
egg = 5
beans = 3
_____ = 0
_____ = egg
egg = beans
beans = _____
What is ... the temporary variable?
[FYI: This code was tested with JDoodle.]
Modulus is ...
What is ... the remainder?
Looping
What is ... when the computer executes (or runs) the same instructions (or commands) over and over?
Conditional
What is ... when the computer "makes a decision" depending a condition or conditions?
The Python keyword used to code (or to define) a function.
What is ... def?
# Hint: To swap the values 5 and 3, fill in the ____.
eggs = 5
ham = 3
spam = 0
_____ = eggs
_____ = ham
_____ = spam
What is ... spam, eggs, ham?
[FYI: This code was tested with JDoodle.]
print(9 % 5)
What is ... 4?
[FYI: This code was tested with JDoodle.]
# Hint: The output
for egg in range(5):
print(egg * egg)
What is ... 0, 1, 4, 9, 16 (each number on its own line)?
[FYI: This code was tested with JDoodle.]
elif
What is ... the contraction of "else if"?
If a function does not have a return statement, then the function will return the value ...
What is ... None?
# Hint: What's wrong?
egg = 5
beans = 3
temp = 0
egg = beans
beans = egg
What is ... overwriting data?
Or what is ... data loss?
Or what is ... the value 5 gets overwritten?
[FYI: This code was tested with JDoodle.]
# Hint: The output
egg = 5
beans = 15
spam = egg % beans
print(spam)
spam = beans % egg
print(spam)
What is ... 5 then 0 (each number on its own line)?
[FYI: This code was tested with JDoodle.]
# Hint: The output.
egg = 0
while egg < 5:
print(egg * egg)
egg += 1
What is ... 0, 1, 4, 9, 16 (each number on its own line)?
[FYI: This code was tested with JDoodle.]
# Hint: The output
FIZZ = 3
BUZZ = 5
FIZZBUZZ = 15
beans = 75
if beans % FIZZBUZZ == 0:
print("FizzBuzz")
elif beans % FIZZ == 0:
print("Fizz")
elif beans % BUZZ == 0:
print("Buzz")
What is ... FizzBuzz?
[FYI: This code was tested with JDoodle.]
# Hint: Fill in the _____.
def max_num(egg, spam):
if egg > spam:
return egg
else:
_____ _____
What is ... return spam?
# Hint: Swap 5 and 3 with one line of code.
egg = 5
beans = 3
_____, _____ = _____, _____
What is ... egg, beans, beans, egg?
[FYI: This code was tested with JDoodle.]
# Hint: The output
egg = 90
FIZZBUZZ = 15
if egg % FIZZBUZZ == 0:
print("FizzBuzz")
What is ... FizzBuzz?
[FYI: This code was tested with JDoodle.]
# Hint: Not the output.
# The coding concept.
egg = 1
while egg > 1:
print(egg * egg)
egg += 1
What is ... an infinite loop?
[FYI: This code was tested with JDoodle.]
# Hint: The output is 49.
# Two lines of code are missing at the end.
FIZZ = 3
BUZZ = 5
FIZZBUZZ = 15
beans = 49
if beans % FIZZBUZZ == 0:
print("FizzBuzz")
elif beans % FIZZ == 0:
print("Fizz")
elif beans % BUZZ == 0:
print("Buzz")
______ _
_____(______)
What is ... else, colon, print, beans?
[FYI: This code was tested with JDoodle.]
[Hint: Related to functions.] Value is to variable as ... _____ is to _____.
What is ... argument, parameter?
Or what is ... argument is to parameter?
# Hint: What was swapped?
egg = 5
beans = 3
spam = 1
egg = beans
beans = spam
spam = egg
What is ... the values 3 and 1?
Or what is ... 3 and ?
Or what is ... 1 and 3?
[FYI: This code was tested with JDoodle.]
# Hint: The output
egg = 5
beans = 0
spam = egg % beans
print(beans)
What is ... ZeroDivisionError?
[FYI: This code was tested with JDoodle.]
# Hint: The output.
for egg in range(10):
if not egg % 2 == 0:
print(egg + 1)
What is ... 2, 4, 6, 8, 10?
[FYI: This code was tested with JDoodle.]
An advanced coder can code without conditionals.
What is ... True?
# Hint: The output.
def mystery_func(spam):
return spam[::-1]
ham = "EDOCOTNRAEL"
print(mystery_func(ham))
What is ... LEARNTOCODE?
[FYI: This code was tested with JDoodle.]