This directory contains projects focused on understanding and implementing modules and command line arguments in Python. The tasks cover concepts such as importing functions, creating modules, and using built-in functions related to modules.
- Why Python programming is awesome
- How to import functions from another file
- How to use imported functions
- How to create a module
- How to use the built-in function
dir()
- How to prevent code in your script from being executed when imported
- How to use command line arguments with your Python programs
Task | File | Description |
---|---|---|
0. Import a simple function from a simple file | 0-add.py | Write a program that imports the function def add(a, b): from the file add_0.py and prints the result of the addition. |
1. My first toolbox! | 1-calculation.py | Write a program that imports functions from the file calculator_1.py , does some math, and prints the results. |
2. How to make a script dynamic! | 2-args.py | Write a program that prints the number of and the list of its arguments. |
3. Infinite addition | 3-infinite_add.py | Write a program that prints the result of the addition of all arguments. |
4. Who are you? | 4-hidden_discovery.py | Write a program that prints all the names defined by the compiled module hidden_4.pyc . |
5. Everything can be imported | 5-variable_load.py | Write a program that imports the variable a from the file variable_load_5.py and prints its value. |
6. Build my own calculator! | 100-my_calculator.py | Write a program that imports all functions from the file calculator_1.py and handles basic operations. |
7. Easy print | 101-easy_print.py | Write a program that prints #pythoniscool , followed by a new line, in the standard output. |
8. ByteCode -> Python #3 | 102-magic_calculation.py | Write the Python function def magic_calculation(a, b): that does exactly the same as a given Python bytecode. |
9. Fast alphabet | 103-fast_alphabet.py | Write a program that prints the alphabet in uppercase, followed by a new line. |