Basic Syntax
Variables
Comments and Types of Data
100

What function do we use to display something on the screen for the user?

print()

100

This common variable type stores letters, numbers, and symbols using quotes.

Strings

100

How do we start a single line comment?

#

200

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!')

200

This variable type stores decimal numbers.

Floats

200

What is wrong with the following single line comment?

/* this is a single line comment

# this is a single line comment

300

How do we know that something is a string?

It has double quotes " " or single quotes ' ' around it.

300
What function do we use to let the user respond to a question we are asking them?

input()

300

What type of data is stored in this variable?

good_grade = True

A Boolean (True/False)

400

Correct the following code:

print{What's up?}

Needs double quotes and parentheses instead of curly brackets

print("What's up?")

400

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 + '!') 

400

What type of data is stored in the following variable?

gpa = 3.2

a float

500

Would this code work?

print("a" + 5)

No.

300 bonus points if you can write a short sentence explaining why.

500

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.

500

Can we combine a string and an integer/float?

No, not without converting it using str()

M
e
n
u