Find the Error!
What's That Name?
Syntax Schmintax
100

Find the error in the statement below. 


print('Errors are no fun!")

The quotation marks need to be the same! 

Corrected would be: 

print("Errors are no fun!")   OR

print('Errors are no fun!')

100

Name two python naming rules.

Some possible answers: 

No starting names with a number

No including special characters

Make the name descriptive and not too long

It is bad practice to start variable names with an underscore


100

What goes on both sides of the variables given to a function?

example- you want to pass x into the print statement, so what goes around x to let the print statement know that you want to print x?

Parenthesis!

print()

200

Find the error in the statement below. 

x = 1

x=+1

print(x)

The correct way to write x = x+1 compactly is: 


x +=1
200

Is the following name good?

centroid_one_

Yes! There is an underscore after the name, which is ok to do in normal practice. 

200

How do you write out exponentials in python math?

Double asterisks!

For example, two squared would be written as 2**2

300

Find the error in the statement below.

##CODE START##

y = (x**3) + 15

print(y)

x is not defined!

300

Is the following variable name valid?

centroid_one-six-four

No! No hyphens allowed!

300

Can I put the pound sign (#) inside a print statement if it is also inside quotation marks?

Yes! You will learn more about this later, but encompassing something in quotation marks in Python makes it a string variable, and Python doesn't care about almost anything inside that string variable. Even though the pound sign means comment, if its inside that string variable, Python only sees it as a string, not as a comment. 

400

Find the error in the statement below. 

x = 1

y = ((x+4 ) + (x-2)))/(x-2)

There is an extra parenthesis after the x-2.

400

Is the following variable name good?


variable_one_that_is_velocity_of_the_thing

No, it is descriptive but way too long. 

400

Can I name a variable print?

No! That is a reserved keyword in Python. You'll come across more of those throughout this class. 

500

Find the errors in the statement below. 

x = 183918

4th_variable = (x/4) + x**2

print("The fourth variable is" 4th_variable)

You can't start a name with a number, and you need to put a comma after "The fourth variable is" in the print statement, so that it looks like: 

print("The fourth variable is" , 4th_variable)

500

Is the following variable name valid?

factorial_var_5! 

No! Exclamation points are special characters and are not allowed!

500
Are indentations important in Python?

Yes! You cannot randomly indent your code, indentations have special meaning. You'll learn more about that later!

M
e
n
u