Skip to content

Latest commit

 

History

History

0x02-python-import_modules

0x02. Python - import & modules

Description

What you should learn from this project:

  • Why Python programming is awesome (don’t forget to tweet today, with the hashtag #pythoniscool :))
  • 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 basics 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