How do you print out the statement : Hello, world!
print ("Hello, world!")
x = 1
What value is stored inside x?
The integer 1
What symbols do you use to write a string?
Use double quotes (" ") or single quotes (' ')
What does the + symbol do to numbers?
adds them together
What will the following code print?
print(4+5)
9
What symbol is used for comments?
The # symbol
What is a variable?
A place in memory that is able to hold a value (word, number, etc.). Each variable has a data type.
"hello" + " " + "world" is an example of what?
Concatenation
What does the - operation do?
subtract
What will the statement print(2*5) output?
10
When assigning a variable, is it = or ==?
=
Which of these are acceptable variable names?
green bean, BlueBerry, red strawberry, orange_orange, Yellow Pineapple
Blueberry, orange_orange
What does the following code print?
tutor = input("Who is the best tutor?")
print("The best tutor is "+ tutor)
What does ** do?
Exponent
What will the statement print(10%3) output?
1
You see a piece of code that looks like this:
txt.upper()
what is it called?
A method or action
What will the below statement output?
print(str(1) + str(3))
13
Name the 3 examples of whitespace.
New line (/n), tab (/t), and space (" ")
What does // do and what is it called?
Divides a number and rounds down. It is called floor division.
What will the statement print(5//2) output?
2
Python is case sensitive. What does this mean?
When naming variables, using capital letters matters. HI, Hi, and hi are all different variable names.
What will the following code print out?
s1 = "abc"
s2 = "ghi"
s2 = s1
s1 = "def"
print (s2 + s1)
abcdef
You are given the variable s = "coding is fun" but only want the "coding" part to be printed. How do you code it?
print(s[0:6])
What does the operator "and" do?
It returns True if both statements are true
What will the statement print(0**56+0*(3*5)) output?
0