Question: Create a Module: Create a Python file named math _ operations.py that includes the following: A function add ( a , b ) that returns
Create a Module: Create a Python file named
mathoperations.py that includes the following:
A function adda b that returns the sum
of a and b
A function subtracta b that returns the
difference between a and b
A constant PI
Write a Script to Use the Module:
In a new file eg main.py import the mathoperations
module and use the functions and constant:
Import the entire module and call the add and subtract functions with
different values.
Print the result of add and subtract
Print the value of PI from the mathoperations
module.
Advanced Imports:
Modify main.py to import only the add function from mathoperations
using from mathoperations import add.
Call the add function and print the result of addUse an alias eg
import mathoperations as mo to access the PI constant.
Create a new file geometry.py inside the same folder, and add a function circlearearadius
that calculates and returns the area of a circle using the formula: area PI
radiusIn your main.py import circlearea from geometry.py and calculate
the area for a circle with a radius of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
