Python -- KBA Flashcards

Based on Midterm review

1
Q

Variables convention is…

A

alphanumeric. They also cannot begin with a number, or have a special character outside of an underscore

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What notation is used for comments?

A

and ‘’’ triple quotes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How does python read?

A

Python operates top to bottom, and left to right with the exception being when you are assigning variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If you try to add an integer to a string during a print statement, what will be your output?
e.g. print(“happy” + 2)

A

Error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

If you try to multiply an integer to a string during a print statement, what will be your output?

A

Multiplication operator on a python list just doubles the list or string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the difference between a statement and an expression?

A

expressions: evaluate to something, can print a result (e.g. function calls, lambdas, yields)
statments: are instructions (e.g. if, for, def, class, so on), don’t evaluate to anything, cannot be printed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly