What does print("Hello") do?
It shows the word Hello on the screen.
What type is "apple" in Python?
String
What loop is used to repeat something a set number of times?
for loop
What comes after if to check another condition?
elif
What numbers are used in binary code?
0 and 1
How do you print your name and age in one line?
Using commas or an f-string: print("I am", name, "and", age, "years old")
What data type is 5.0
Float
What does this print?
Jump
Jump
Jump
What keyword do we use to define a function?
def
What symbol starts a comment in Python?
#
What does this print? print("5","5")
It prints -> 5 5
What value type is used for True/False?
Boolean (bool)
What does a while loop do?
Repeats as long as a condition is true.
#Fix error
def say_hello
print("Hello")
def say_hello()
What’s one big difference between a set and a list?
Sets don’t allow duplicates and are unordered.
What does print("Hi", end="!") do?
It prints “Hi!” with no newline.
Which of these is a valid variable name: 2cool , my_age, @home, _hell , if , hey1
my_age , _hell , and hey1
What is wrong with this loop?
It never stops (infinite loop)
age = 6
if age > 10:
print("Old")
else:
print("Tiny")
Tiny
ab = {1,7,5,7,7,8,3}
print(ab)
{1,7,5,8,3}
Fix the error: print("I am" + 10)
You need to convert the number: print("I am " + "10")
How do you obtain a float input from the user?
float(input("...")) or
float(input())
Write a program to print numbers from 10 to 1 using loops.
for num in range(1, 6):
if num >= 4:
print(num)
4
5
Fix the code
name = input("What is your name?")
print("Hello, name")
print("Hello", name)