Python Flashcards
0
Q
How do you declare variable type in Python?
A
Python will automatically determine the type of variable. So you can simply do:
A = 5
Or
A = “Hi there”
1
Q
How do you show a code block in Python?
A
Python uses indentation instead of {} . Python will even throw an error if indentation isn’t consistent.
2
Q
Show a while statement, including code block in Python
A
while a<10:
print a
Note: the colon and indentation are required for this answer.
3
Q
Define a function in Python.
A
def function(param1,param2):
code
code