

Summer Lesson 25
Presentation
•
Computers
•
9th - 12th Grade
•
Practice Problem
•
Hard
Robert Giordano
FREE Resource
6 Slides • 3 Questions
1
Lesson 25
Creating Modules
2
Consider a module to be the same as a code library.
A file containing a set of functions you want to include in your application.
Simply, a module is a file consisting of Python code. A module can define functions,
classes and variables. A module can also include runnable code.
The benefit of modules is that it provides a way to share reusable functions.
What is a Module?
3
To create a module just save the code you want in a file with the file extension .py:
Creating a Module
4
Use a Module
In your other file:
Import the module named mymodule, and call the greeting function:
Note: When using a function from a module, use the syntax: module_name.function_name.
5
Fill in the Blanks
6
Variables in Module
Save this code in the file mymodule.py :
In your main file:
7
Fill in the Blanks
8
Renaming a Module
You can name the module file whatever you like, but it must have the file
extension .py
You can create an alias when you import a module, by using the as keyword:
Create an alias for mymodule called mx:
9
Fill in the Blanks
Lesson 25
Creating Modules
Show answer
Auto Play
Slide 1 / 9
SLIDE
Similar Resources on Wayground
8 questions
Modernist Poetry and Imagist assignment
Presentation
•
9th - 12th Grade
8 questions
SAS Programming Review (Modules 1-7)
Presentation
•
9th - 12th Grade
10 questions
CSP 1.1 Review - What is Computer Science?
Presentation
•
9th - 12th Grade
5 questions
Repetition
Presentation
•
9th - 12th Grade
6 questions
What IS Adobe?
Presentation
•
9th - 12th Grade
6 questions
ww 2 pacific
Presentation
•
9th - 12th Grade
6 questions
Unit 4 introduction Canada
Presentation
•
9th - 12th Grade
10 questions
Code Structure / Defining Functions / Finishing Strong
Presentation
•
8th - 12th Grade
Popular Resources on Wayground
10 questions
HCS SCI 03 Summer School Assessment 1
Quiz
•
3rd Grade
15 questions
HCS SCI 05 Summer School Assessment 1 Review
Quiz
•
5th Grade
22 questions
Day 9 Equations and Inequalities Review
Quiz
•
9th Grade
10 questions
Writing and Identifying Ratios Practice
Quiz
•
5th - 6th Grade
7 questions
PYRAMID PERSPECTIVES part 1
Presentation
•
9th - 12th Grade
12 questions
Understanding the Fourth of July
Quiz
•
9th Grade
15 questions
Soccer World Cup Quiz Questions
Quiz
•
7th Grade