Question 1 (Easy):
What is the output for the code “if weather == snowy:
print(“wear a jacket”)
Else:
print(“youre good!”)”
If you say the weather is snowy?
wear a jacket
for i in range(10):
print('User')
What does the indented code in this scenario do?
The indented code of this loop is the part of the code that repeats.
user = input("user: ")
password = input("pass: ")
if user == "VIP" and password == "VIP_lounge":
print("Door opened")
else:
print("Access denied")
If the username was “VIP” and password was “VIP123” the code would come out as “Door opened”.
False
print("hello)
What kind of error is this
Syntax Error
What is loop logic?
Loop logic is automatic repetition in programming.
for i in range(1, 22):
if i % 7 == 0:
print(i)
Which numbers will this code print out when run? Say it in the correct order.
7, 14, and 21
for i in range(10, 0, -2):
print(i)
What does the -2 do to the code
It makes i decrease by 2 every jump
x = 7
if x % 2 == 0:
print("Even")
elif x > 5:
print("Big")
else:
print("Small")
What is the output of this code?
Big
num = 7
if num % 2 = 0
print("Even")
else
print("Odd")
Name all errors in this code.
Whats a double equal sign? Whats a colon?
What does the “for” loop do?
The for loop is a tool that repeats a block of code, where “for” starts the loop and it goes on for a specific number of times.
age = int(input("what is your age "))
license = input("do you have a license ")
if age >= 18:
print("You are old enough to be considered an adult.")
if license == "yes":
print("You can drive legally.")
else:
print("You need a license to drive.")
else:
print("You are too young to drive.")
What is the output of this code if you write your age as 26 and write “no” for license.
“You are old enough to be considered an adult.
You need a license to drive.”
True or false:
for i in range(6):
print(i * 2)
The output of this code will be
“0
2
4
6
8
10”
True
x = 6
y = 4
if x * 2 == 12 and x % 4 == 2:
print("First")
elif y * 2 < x and x % 2 == 0:
if y == 3:
print("Second")
else:
print("Third")
else:
print("Fourth")
What will this print?
First
num = -3
if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")
Name the error of this prompt (missing colon, missing space, missing quotation, etc.)
What is an indentation error?
What is the Boolean Logic?
Boolean logic is a system of math and logic where variables are only TRUE or FALSE (1 or 0) and combined using operators like AND, OR, and NOT