What is the output to
print("hello world")
The output to print("hello world") is "hello world".
for i in range(5):
print("Hello")
Answer: 5 times
What if you have another if statement but want a different answer
If you wish to have another if statement but with a different answer, you can use elif.
Why does this code cause an error?
Answer:
x is used before it is defined.
What is a variable?
Answer:
A variable stores data that can change while the program runs.
what is the mistake for
x = (how was your day")
if x = (''good''):
that's good
else:
("I don't know about that")
The mistake for this is the 2nd line
Question: What is printed?
What does the text below mean if you put in ‘10’ as an answer
Age = input(“age”)
age= int(age)
If age >= 13:
print(“teen”)
else :
print(“not teen”)
If you put 10 as an answer, the output will be "not teen".
What is wrong with this loop?
Answer:
The loop never ends.
What does a loop do?
Answer:
A loop repeats a block of code multiple times.
what will happen if you put yes and 20 in this code
age=int(input(“age:”))
student=input(“student? yes/no:”)
If age >= 13:
If student == “yes” and age <18:
print(“teen student”)
Else:
print(“not a teen student”)
not a student
What is the output?
count = 0
while count < 3:
print(count)
count += 1
Answer:
0
1
2
X = 5
If 5 > 10:
print(“big”)
Elif 5 > 3 and 5<10
print(“medium”)
Else:
Print (“small”)
Since 5 is below 10, it will not print big, and since it is above 3 and below 10, it will print medium.
Why doesn’t this code work as expected?
Answer:
The assignment operator is used instead of a comparison operator.
What is the difference between = and ==?
Answer:
= assigns a value, while == compares two values.