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”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

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

Define a function in Python.

A

def function(param1,param2):
code
code

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