2. Python¶
Usually, we want to repeat a series of commands several times
One way to do this is to use a function
Don’t forget parentheses when calling the function!
If you forget the parentheses, Python will return the memory address where the function is defined.
We can put parameters in a function
Functions cease to exist as soon as you exit the Python interpreter
Hence, programs generally consist of modules, which are files stored on disk
A module is a text file containing a Python program
You can edit modules in a development environment, which highlights reserved words, performs automatic indentation, etc.
We save a program called
chaos.py
Don’t forget the
.py
extensionWe can run the program with the “Run” button.
You have attempted of activities on this page