What is the name of the programming language we are learning?
Python.
if answer = "yes":
print("The answer was yes")
you need two equal signs
num = 5
if num < 10:
print("Test 1")
Test 1
What does this code print?
num = 0
while num <= 4:
print(num)
num = num + 1
0
1
2
3
4
What does this function do?
def mystery():
answer = input("What is your name?")
print("Hello, " + answer)
Asks the user for their name and then prints a greeting using their input
What sport does Maeve play?
Lacrosse
What is wrong with this code?
answer == "yes"
if answer == "yes"
print("The answer was yes")
if answer == "no"
print("The answer was no")
num = 2
if num > 5:
print("Test 1")
elif num < 3:
print("Test 2")
Test 2
What does this code print?
num = 5
while num > 0:
print(num)
num = num - 1
5
4
3
2
1
define a function named square
def square():
How many cats does Celia have?
2
if answer == "10"
print("The answer was 10")
you need a colon at the end of the line
num = 10
if num < 15:
print("Test 1")
if num == 10:
print("Test 2")
Test 1
Test 2
Write code to make the user try again if their input is not yes or no
answer = input("Type yes or no")
while answer != "yes" and answer != "no":
answer = input("Try again. Type yes or no")
Reusability, indentation, parenthesis (parameters/arguments, colons, organization.
What happens when you back away from the tornado in Celia's Tornado Twisters game?
It starts raining cheese
What is wrong with this code?
def favorite color():
answer = input("What is your favorite color?")
print("That is a good favorite color")
favorite color cannot be two words it has to be either favoriteColor or favorite_color
num = 9
if num == 10:
print("Test 1")
elif num == 8:
print("Test 2")
elif num == 7:
print("Test 3")
else
print("Test 4")
Test 4
num = 5
while num == 5:
print(num)
will print 5 forever
Write a function that asks the user how old they are and figures out when they were born.
def age():
answer = input("How old are you?")
yearBorn = 2024-answer
print("You were born in " + yearBorn)
What does IDE stand for?
Integrated development environment.
What is wrong with this code?
hello()
def hello():
print("Hello")
You have to define the function before you call it
Write code to make the user input a number. If the number is less than 5 print "Less than 5" if the number is greater than 5 print "greater than 5" and if the number is equal to 5 print "it is 5"
num = input("Pick a number")
if num < 5:
print("less than 5")
elif num > 5
print("greater than 5")
elif num == 5:
print("it is 5")
Write code to use a while loop to count from 0 to 10 by twos.
num = 0
while num <=10:
print(num)
num = num + 2
Make a function that asks for the user's favorite food and prints it three times.
def food():
answer = input("What is your favorite food?")
i = 0
while (i < 3):
print(answer)