Functions use arguments
Print(variable) for example
In this example
- def spam():
- eggs = 99
- return eggs
- number = spam()
- print (number)
Line 6 needs the argument (number) or it will never print 99, you will get an error.
Global and local scope.
pythontutor.com/visualize.html
Change a global variable with a local scope variable
- def spam():
- global eggs
- eggs = 'Hello'
- print = (eggs)
- eggs = 42
- spam()
- print(eggs)
Try and Except
Left off on lecture 12
No comments:
Post a Comment