Directions
Calculates the Letter grade for a class in a nearby university assuming a scale of 1000 points for the class and uses the grade from the syllabus:
|
Points |
Grade |
|
92- 100% |
A |
|
88- 91.99% |
B+ |
|
82-87.99% |
B |
|
78- 81.99% |
C+ |
|
70- 77.99% |
C |
|
60 - 69.99% |
D |
|
< 60% |
F |
To do this program you need to define 3 functions: They are
def main():
The main function first calls the display title function which displays the title. Next the main functions requires the user to input the total number of points earned. Main then passes the total_points to the get_grade which uses if, elif, else to return the correct letter grade. The main function then prints the letter grade and asks the program should continue. If yes, run the program again or print Bye.
def display_title():
Displays the title of the program when called.
get_grade():
This functions receives the total_points from the main() and returns the letter grade.
Be sure to add try - except to ensure that only valid values are entered.
2. (Part 4b) There should also be a file called activity4b.py Use this for the following program.
Create a simple metropolitan delivery cost calculator for a new mail and small package courier service in Omaha
1. Minimum cost pick up and delivery of a 1.99 pounds or less package within Omaha City Limits with a guaranteed delivery time of 2 hours is $7.95
2. Express time of one hour or less adds $2.00 to the delivery price.
3. Add $1.00 for every pound over 1.99 lbs up to 49.99 lbs. The company does not accept a single package over 50 lbs.
To do this program you need to define 3 functions: They are
def main():
The main function first calls the display title function which displays the title. Next the main functions requires the user to input the a 2 for 2 hours or less or a 1 for 1 hour delivery or less. They also must enter the weight of the package in pounds. Main then passes the delivery time indicator(1 or 2) and the weight in pounds to the get_delivery_price which uses if, elif, else and calculations to return the correct the total delivery price for the package. The main function then prints the total delivery price and asks if the program should continue. If yes, run the program again or print Bye.
def display_title():
Displays the title of the program when called.
get_delivery_price():
The get_delivery_price function uses if, elif, else and calculations to return the correct total delivery price for the package and returns it to main for printing.
Be sure to add try - except to ensure that only valid values are entered.
Submitting your assignment
1. When you are happy with your working code push the code to GitHub and be sure your GitHub repository is updated.
2. Create a word document and make one or more screenshots of the code working in the command line (run several different grades through the program and add it to the word document Labeled ISQA 3900 Activity 4.
Rubric
|
Exemplary (from 90 to 100%) |
Competent (from 80 to 89%) |
Acceptable (from 70 to 79%) |
Insufficient (below 70%) |
|
|
Python Code (max 15 pts) |
Functions as described above and has appropriate comments in the code |
Generally functions as described above and has some but not all comments |
Partially functions as described above and may lack appropriate comments |
Does not function as described above and lacks comments |
|
Git and GitHub (max 5 pts) |
One or more commits with all code replicated and appropriate commit comment |
.Code updated in GitHub but lacking an appropriate commit comment |
Code not updated in GitHub |
Code not updated in GitHub |
activity4.py
def get_grade(marks):#get_grade function that will find the
grade and return it
percentage=(100*marks)/1000
if percentage>=92 and percentage<=100:
return "A"
elif percentage>=88 and percentage<=91.99:
return "B+"
elif percentage>=82 and percentage<=87.99:
return "B+"
elif percentage>=78 and percentage<=81.99:
return "B+"
elif percentage>=70 and percentage<=77.99:
return "B+"
elif percentage>=60 and percentage<=69.99:
return "B+"
else:
return "D"
def display_title():#display_title funtction will display the
title
print(" *******Letter grade Calculator******* ")
def main():
display_title()
while(True):#while loop untill user press n
try:
point = float(input("Enter the total number of points earned:
"))
print("You letter grade is :",get_grade(point))
except ValueError:
print("Invalid input.")
choice=input("Do you want to find another grade (y/n)?")
if(choice=="y" or choice=="Y"):
continue
if(choice=="n" or choice=="N"):
print(" Bye")
break
main()
output

code snaps

acticity4b.py
def get_delivery_price(timeIndi,weight):
if(timeIndi==2):
if(weight<1.99):
return 7.95
else:
extraWeigt=int(weight-1.99)
return (7.95+extraWeigt)
else:
if(weight<1.99):
return 9.95
else:
extraWeigt=int(weight-1.99)
return (9.95+extraWeigt)
def display_title():#display_title funtction will display the
title
print(" *******Metropolitan delivery cost calculator******* ")
def main():
display_title()
while(True):#while loop untill user press n
try:
timeIndicator = int(input("Input the a 2 for 2 hours or less or a 1
for 1 hour delivery or less.: "))
if(timeIndicator>2 or timeIndicator<0):
print('The delivery time indicator must be 1 or 2')
continue
weight=float(input(" Enter the weight of the package in
pounds."))
if(weight>50 or weight<0):
print(" The company does not accept a single package over 50
lbs.")
continue
print(" The total delivery price for the package:
$",get_delivery_price(timeIndicator,weight))
except ValueError:
print(" Invalid input.")
choice=input(" Do you want to find another cost (y/n)?")
if(choice=="y" or choice=="Y"):
continue
if(choice=="n" or choice=="N"):
print(" Bye")
break
main()
output
codesnaps

If you have any query
regarding the code please ask me in the comment i am here for help
you. Please do not direct thumbs down just ask if you have any
query. And if you like my work then please appreciates with up
vote. Thank You.
Directions (Part 4a) Sign in tor GitHub and pull latest updates. In the “activity4” folder there...
Need help writing this code in python.
This what I have so far.
def display_menu():
print("======================================================================")
print(" Baseball Team Manager")
print("MENU OPTIONS")
print("1 - Calculate batting average")
print("2 - Exit program")
print("=====================================================================")
def convert_bat():
option = int(input("Menu option: "))
while option!=2:
if option ==1:
print("Calculate batting average...")
num_at_bats = int(input("Enter official number of at bats:
"))
num_hits = int(input("Enter number of hits: "))
average = num_hits/num_at_bats
print("batting average: ", average)
elif option !=1 and option !=2:
print("Not a valid...
VERY URGENT*** THANK YOU IN ADVANCE: THIS IS THE CODE I HAVE GOTTEN SO FAR: PYTHON This is a code that is supposed to help someone study/ practice for jeopardy. The two functions described below are required for this assignment. You may add other functions that you think are appropriate: menu() This function, which displays all the user options to the screen, prompt the user for their choice and returns their choice. This function will verify user input and ALWAYS...
Propose: In this lab, you will complete a Python program with one partner. This lab will help you with the practice modularizing a Python program. Instructions (Ask for guidance if necessary): To speed up the process, follow these steps. Download the ###_###lastnamelab4.py onto your desktop (use your class codes for ### and your last name) Launch Pyscripter and open the .py file from within Pyscripter. The code is already included in a form without any functions. Look it over carefully....
HEy GUYS PLZ I WROTE THIS CODE BUT I WAS ASKED TO ADD SOME
ASSERTION TESTS AND I HAVE NEVER DONE SUCH THING. CAN YOU GUYS
HELPS ME OUT ON HOW TO TEST A SIMPLE CODE SINCE ITS A GUESSING
GAME! THANK YOU. PYTHON
import random # here it allows us to use the benefits of the functions random #function 1 which is just a screen organized wordings def screen): screeninstructions () name input("Your Name : ") print('Welcome, name, 'This...
C PROGRAMMING Introduction In this part, you will solve a problem described in English. Although you may discuss ideas with your classmates, etc., everyone must write and submit their own version of the program. Do NOT use anyone else’s code, as this will result in a zero for you and the other person! Shipping Calculator Speedy Shipping Company will ship your package based on the weight and how far you are sending the package, which can be anywhere in the...
Look at this partial class definition, and then answer questions a - b below: Class Book Private String title Private String author Private String publisher Private Integer copiesSold End Class Write a constructor for this class. The constructor should accept an argument for each of the fields. Write accessor and mutator methods for each field. Look at the following pseudocode class definitions: Class Plant Public Module message() Display "I'm a plant." End Module...
Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development practices and problem solving strategies: a) Start by writing the documentation for the function. Use docstrings shown in lecture and lab. b) Write test calls to the function in your main function for the different cases of input the function will encounter. This will help you understand the behavior of the function and later behave as tests for your function. c) Define the function d)...
Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate the number of test scores the user enters; have scores fall into a normal distribution for grades -Display all of the generated scores - no more than 10 per line -Calculate and display the average of all scores -Find and display the number of scores above the overall average (previous output) -Find and display the letter grade that corresponds to the average above (overall...
18.1 Lab Lesson 11 (Part 1 of 1) Part of lab lesson 11 There in one part to lab lesson 11. The entire lab will be worth 100 points. Lab lesson 11 part 1 is worth 100 points For part 1 you will have 80 points if you enter the program and successfully run the program tests. An additional 20 points will be based on the style and formatting of your C++ code. Style points The 20 points for coding...
5.Implement a superclass Appointment and subclasses Onetime, Daily and Monthly. An appointment has a description (for example, “see the dentist”) and a date. Write a method occursOn(year,month,day) that checks whether the appointment occurs on that date. For example for a monthly appointment, you must check whether the day of the month matches and the appointment date started before the date entered. Then, fill a list of Appointment objects with a mixture of appointments. Have the user enter a date and...