What function do we use to display something on the screen for the user?
print()
This common variable type stores letters, numbers, and symbols using quotes.
Strings
How do we start a single line comment?
#
What is wrong with the following code?
print('Hello World!")
Only has one single quote and one double quote. Needs to look like this
print("Hello World!")
OR
print('Hello World!')
This variable type stores decimal numbers.
Floats
What is wrong with the following single line comment?
/* this is a single line comment
# this is a single line comment
How do we know that something is a string?
It has double quotes " " or single quotes ' ' around it.
input()
What type of data is stored in this variable?
good_grade = True
A Boolean (True/False)
Correct the following code:
print{What's up?}
Needs double quotes and parentheses instead of curly brackets
print("What's up?")
How do you combine text and a variable in a print() statement?
Use a + sign
Example: print('You said your favorite animal is a ' + favorite_animal + '!')
What type of data is stored in the following variable?
gpa = 3.2
a float
Would this code work?
print("a" + 5)
No.
300 bonus points if you can write a short sentence explaining why.
Which line of code correctly asks the user for their name and assigns it to a variable called name?
input = name("What's your name?")
name = input('What's your name?')
name = input("What's your name?")
input = name("What's your name?)
name = input("What's your name?")
Double quotes since we are using an apostrophe in "What's" and the variable should be called name, which is told to you in the question.
Can we combine a string and an integer/float?
No, not without converting it using str()