what is wrong with this code?
print("hello world')
mismatched quotation marks
if x = 10:
print("x is 10")
elif x < 10:
print("less than 10")
else:
print("greater than 10")
no double equal
write a for loop that counts from 1 to 10 by 3s.
for i in range(1,11,3):
print(i)
Write a print function that says "Hello" in a bright color
Multiple correct answers.
Have coaches verify
What imports have we learned this week?
import random
import turtle
When do I need to indent a line of code?
After a colon when we are trying to represent that a piece of code is inside another piece of code
How many elifs can I have after 1 if statement?
as many as you want
what is the difference between a for loop and a while loop?
For loop is used when the number of iterations is already known. While loop is used when the number of iterations is unknown. (Other answers are acceptable as well)
If \033[31m is red,
What is \033[91m
bright red
Write the code to draw an L in turtle
Multiple correct answers.
Have coaches verify.
what is wrong with this code? Name 3 things
num = 3
if num != 5
print("not equal!")
else:
print("equal!")
no colon after if, no indentation of print("not equal!") and the else is indented under the if
Do I always have to have an else statement after an if/elif statement?
No
What is the output of this loop?
i=10
while 7 * 3 >= 21:
print(i)
i-=1
infinite loop
Which of these are not ANSI colors? (There are 2)
Red, Orange, Green, Yellow, Blue, Magenta, Violet, Cyan, Black, White
Orange & Violet
Name 4 projects you have completed this week in camp
Acceptable Answers:
Choose your own adventure, calculator, number guesser, rock paper scissors, turtle names.
what is the error in this code and how would i fix it?
num = int(input("enter a number: "))
print(num + " is the number you chose!")
cannot concatenate ints and strings must use str() around num to use plus sign with it
list 6 Python operators (partial credit is possible)
<, <=, >, >=, ==, !=
output?
x = 50
while x > 5:
print(x)
x /= 2
50
25.0
12.5
6.25
What is the output?
RED = "\033[31m"
BLUE = "\033[34m"
BRIGHT_MAGENTA = "\033[95m"
print(RED + "He" + BRIGHT_MAGENTA + "ll" + BLUE + "o!")
"Hello!" with:
"He" being red
"ll" being bright magenta
"o!" being blue
What will this draw?
for I in range(4):
t.right(90)
t.forward(80)
A square
Name all 7 problems
def max(a, b)
If a > b:
print("a is greater!'}
else a < b
print("b is greater")
no colon after def, mismatched quotations, mismatched brackets, no condition for else, no colon after else, print is not under else, no function call
write a program using conditionals that checks if a number is even.
num = int(input("enter a num: "))
if num % 2 == 0:
print("even")
else:
print("odd")
What is the output?
food = ["apple","grape","cookie","bread"]
for i in range(0,4):
print(food[i] + ",")
apple,
grape,
cookie,
bread,
Which of these will print out "Hello" in red text.
(A) print("\033[31mHello")
(B) print("\033[31m" + "Hello")
(C) print("\034[31mHello")
(D) print("\033[31m")
print("Hello")
(E) print("\033(31mHello")
A, B, and D
Why won't this code work?
num = input("Enter a number to add to 3: ")
sum = num + 3
print(sum)
num() is a string and cannot be used in a math operation