Assignment Prompt & Instructions
**ASSIGNMENT**
**You are going to enhance the prior assignment by doing the following.**
– Move all the def functions into W5_firstname_lastname_Mylib.py
– Use import to include W5_firstname_lastname_Mylib into the code
– Test the code and make sure that the prior code is still working (Create your own application/test in the program using the library)
– Add the following **function** into Mylib (see attached video from week3 for hints)
scalc(p1)
p1 will be a string like this "N1, N2, operator"
examples
scalc("20,30,*")
the result will be 600
scalc("50,20,+")
the result will be 70
scalc("50,20,-")
the result will be 30
scalc("60,20,/")
the result will be 30
– Use string functions to parse the first number, the second number, and the operator from the input string.
– Use the prior functions (add, subtract, divide, and multiply) to do the calculations.
– **Do not use any UI functions in the library such as print(),** input(), and format. A function should accept a parameter and return at least one value to the caller.
**Submission Instructions:**
Make sure that you save your code as text in this format.
W5_firstname_lastname.py
W5_firstname_lastname_Mylib.py
Hints:
_**Week 5, 6**_
1) library
"""
comment block
"""
# def functions
def add …
def sub ….
def mul
def div
def isinrange
def scalc
2) Program
import the library as **sam** >>> use your initials <<<
while True:
try:
# set limits lr and hr
lr = input(low limit range)
hr = input(high limit range)
# get user lower range and user high range
ulr=enter user lower range between the lower limit and high limit
uhr=enter user high range between the lower limit and high limit
#check to see in ulr and uhr are in the ranges
if( **sam**.checknum(lr,ulr,hr) and **sam**.checknum(lr,uhr,hr)):
**Assessment Rubric**
**Exemplary (25-20)**
**Accomplished**
**(19-10)**
**Developing**
**(9-1))**
**Beginning**
**( 0)**
**Points Available**
– Assignment details in a comment block
The student **effectively** completed the assignment.
The student **partially** completed the assignment.
The student provided **limited and meaningless** substance to complete the assignment.
The student **failed** to complete the assignment.
25
– Moving reusable functions into a module
The student **effectively** completed the assignment.
The student **partially** completed the assignment.
The student provided **limited and meaningless** substance to complete the assignment.
The student **failed** to complete the assignment.
25
– Using string functions to parse the input parameter
– Code comments
The student **effectively** completed the assignment.
The student **partially** completed the assignment.
The student provided **limited and meaningless** substance to complete the assignment.
The student **failed** to complete the assignment.
25
– The print function used to correctly print the solution (application is running)
The student **effectively** completed the assignment.
The student **partially** completed the assignment.
The student provided **limited and meaningless** substance to complete the assignment.
The student **failed** to complete the assignment.
25
\
scalc.zip](https://www.sweetstudy.com/files/scalc-zip "scalc.zip")
\
Lib_fun.zip](https://www.sweetstudy.com/files/lib-fun-zip "Lib_fun.zip")