Variable Types
Print/Input
Math
IF
General
100
variable = "this"
String
100
What does this output? print("Hello, World")
Hello, World.
100
How do you print the sum of the variables a and b
print(a+b)
100
Why would you need an if/else statement?
To control the flow of code execution.
100
Who is NOT Ariel’s future husband?
JOSEPH
200
variable = 22
Integer
200
How would you get an input from the user and assign it to a variable named name?
name = input()
200
What does the // operator do?
Floor division (no remainder)
200
How do you write the statement “If the number is 2 then print x”
if num == 2: print(x)
200
What year was AOIT started?
2003/2004
300
variable = 55.5
Float
300
How do you ask the user to enter their integer age?
age = int(input())
300
What does the % operator do?
Get the remainder
300
How do you write the statement "If a varibale named num is equal, print "Equal"
if (num % 2 ==0): >print("Equal")
300
Where are ball pythons found?
Africa
400
variable = True
Boolean
400
What does a float input look like?
decimal = float(input())
400
How do you take a variable named userNumber and add 1 to its value.
userNumber += 1 or userNumber = userNumber + 1
400
How do you write the statement "If a varibale named num is odd, print "odd"
if (num % 2 ==1): >print("odd")
400
Is Python interpreted or compiled?
interpreted
500
What is a variable?
Something that stores a value.
500
How do you make two print statements print on the same line?
print(a, end="") print(b, end="")
500
Write a program to enter a temperature in degrees Fahrenheit and display the equivalent temperature in degrees Centigrade.
a = int(input()) print((a - 32) * (5/9))
500
Write a program that asks for your age. If you are over 18 it outputs the message, “Over 18”, otherwise it outputs, “Under 18”.
age = int(input()) if age > 18: >print("Over") else: >print("Under")
500
What is the difference between interpreted and compiled?
An interpreted language is a programming language for which most of its implementations execute instructions directly, without previously compiling a program into machine-language instructions.