Skip to content

Latest commit

 

History

History

0x02-python-import_modules

0x02. Python - import & modules

Resources:books:

Read or watch:


Learning Objectives:bulb:

What you should learn from this project:

  • 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

  • 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 + 2 = 3
  • Write a program that imports functions from the file calculator_1.py, does some Maths, and prints the result.
  • Write a program that prints the number of and the list of its arguments.
  • Write a program that prints the result of the addition of all arguments
  • Write a program that prints all the names defined by the compiled module hidden_4.pyc (please download it locally).
  • Write a program that imports the variable a from the file variable_load_5.py and prints its value.
  • Write a program that imports all functions from the file calculator_1.py and handles basic operations.
  • Write a program that prints #pythoniscool, followed by a new line, in the standard output.
  • Write the Python function def magic_calculation(a, b): that does exactly the same as the following Python bytecode:
  • Write a program that prints the alphabet in uppercase, followed by a new line.

Author