Skip to content

Latest commit

 

History

History
78 lines (71 loc) · 1.34 KB

File metadata and controls

78 lines (71 loc) · 1.34 KB

img

Imports and modules

Question #0

What do these lines print?

>>> def my_function(counter=89):
>>>     print("Counter: {}".format(counter))
>>> 
>>> my_function()
  • Counter: 101
  • Counter: 12
  • Counter: 89

Question #1

What do these lines print?

>>> def my_function():
>>>     print("In my function")
>>> 
>>> my_function
  • function my_function at …
  • “In my function”
  • In my function
  • Nothing

Question #2

What do these lines print?

>>> def my_function(counter):
>>>     print("Counter: {}".format(counter))
>>> 
>>> my_function(12)
  • Counter: 12
  • Counter: counter
  • Counter: c

Question #3

What do these lines print?

>>> def my_function():
>>>     print("In my function")
>>> 
>>> my_function()
  • function my_function at …
  • “In my function”
  • In my function
  • Nothing

Question #4

What do these lines print?

>>> def my_function(counter=89):
>>>     return counter + 1
>>> 
>>> print(my_function())
  • 90
  • 1
  • 89
  • 891

Question #5

What do these lines print?

>>> def my_function(counter=89):
>>>     print("Counter: {}".format(counter))
>>> 
>>> my_function(12)
  • Counter: 101
  • Counter: 12
  • Counter: 89