Python -- KBA Flashcards
Based on Midterm review
Variables convention is…
alphanumeric. They also cannot begin with a number, or have a special character outside of an underscore
What notation is used for comments?
and ‘’’ triple quotes
How does python read?
Python operates top to bottom, and left to right with the exception being when you are assigning variables
If you try to add an integer to a string during a print statement, what will be your output?
e.g. print(“happy” + 2)
Error
If you try to multiply an integer to a string during a print statement, what will be your output?
Multiplication operator on a python list just doubles the list or string.
What is the difference between a statement and an expression?
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