Stanford Python Camp D – 3

Share:

D-3: Using “if-elif-else” statements and printing consequential outcomes

Assignment 3 – A. Grade Calculator

Write a grading program for a class with the following grading policies:

  • There are 2 quizzes, each graded on the basis of 10 points.
  • There are 3 assignments, each graded on the basis of 10 points.
  • There is one midterm exam, graded on the basis of 100 points.
  • There is one final exam, graded on the basis of 100 points.

The final grade is calculated based on the following weighted points:

The 2 quizzes count for a total of 10% of the final points

The 3 assignments count for a total of 30% of the final points

The midterm exam counts for 20% of the final points

The final exam counts for 40% of the final points

Write a program to prompt for points earned quizzes, assignments, midterm, and final exam and display the grade and the message string for on the grade.

Assignment 3 – A code
Assignment 3 – A outcome

Assignment 3 – B. Pizza cost

Write a program to calculate the price of a pizza. The cost of each pizza is determined as follows:

  • Small: $10 + $2 per topping
  • Medium: $12 + $3 per topping
  • Large: $14 + $4 per topping

Your program should prompt for the size, number of topics, and the number of pizzas and print the final cost. You can assume that the customer buys only one type of pizza.

Assignment 3 – B code
Assignment 3 – B outcome

Assignment 3 – C. Telephone Charges

The Graham Bell Telephone company charges customers using the rates on the following table based on the number of minutes, text messages, and data usage.

If the customer does not use any minutes, messages, or data then the customer should not be charged for that service. Write a program that prompts the user to enter the number of minutes, text messages, and GigaBytes of data used and prints the total charges for customers.

Assignment 3 – C code
Assignment 3 – C outcome

Stay In Touch.

  • kimhannah2005@gmail.com