How do I write a print statement? Write on the board...
(Output -> Hello World)
print("Hello World")
How many types of variables have we learned about so far this year?
3
How do I get user input of a string? Write in on the board...
name of variable is csp
csp = input("Input a string: ")
What is the first thing we take care of in our order of operations?
Parentheses
How do we add two strings together?
Using the '+' sign.
What does the following Python code display?
print("Hello")
print("World")
Hello
World
What are the types of variables that we have learned so far this year?
String, Int, Float
How do I get user input of a int? Write in on the board...
name of variable is csp
csp = int(input("Input a string: "))
What does this operator mean?
%
Remainder (modulus sign)
What will the following code output?
print("Hello" + "" + "World.")
HelloWorld.
What will the following program print me?
print("Mr. Merlo = " + 5)
Error!
What types of variables are the following:
5.0
5
"5.0"
Float
Int
String
How do I get user input of a float? Write in on the board...
name of variable is csp
csp = float(input("Input a string: "))
What does the // sign mean?
Integer division.
What will be output by the following code?
for x in range(4):
print("Merlo")
Merlo
Merlo
Merlo
Merlo
What will this print?
print("")
A blank line.
Tell me why all integers/floats can be strings, but not all strings can be integers/floats.
Because letters cannot be turned into numbers, python will give us a typeError.
var = float(int("What is your integer?"))
print(var)
7.0
What is (9*3+37%11*3//4)?
What will be the output of this program?
for x in range(2):
print("Merlo" * (2 + 8 // 3 / 2))
MerloMerloMerlo
MerloMerloMerlo
What will this print?
for x in range(4):
if x != 3:
print(x)
0
1
2
What will be the output of my program?
1variable = 24
print(24)
Error.
What is the output of my program if my user enters 6?
var = float(int(input("What is your integer?"))**2)
print(var)
36.0
What is 345%10*9+6*45//9?
75
How many mathematical operators can we perform on strings w/ other strings or integers?
2, '+' and '*'.