Lab Assignment
Input in Python:
- For integers use: int(input("user prompt "))
- For floats use: float(input("user prompt "))
- For strings use: input("user prompt ") and when inputing the string
you must enclose it in double or single quotes
- For formatted output use function format.
- For example, to print only 2 decimal digits of the number
1232.566777 use the
following statement:
print(format(1232.566777, '.2f'))
- For example, to print only 4 decimal digits of the number 1232.566777
use the
following statement:
print(format(1232.566777, '.4f'))
Lab Assignment
- Problem 1 (90 points):
A customer comes to the store and buys 1 bottle of milk, 1 tray of eggs,
and 1 loaf of bread.
Write a program that asks user to enter the price for each item and find
the total price and the average price.
- Problem 2 (10 points): The final grade in our course is
calculated according to the following rule:
Final Grade
Laboratory Sessions | 45% |
Exams | 35% |
Mini-Quizzes | 15% |
Homework and Attendance | 5% |
Write a program that asks user to enter the average grade for all quizzes,
average grade for all exams, average grade for all homeworks, and the lab
grade. The program calculates the final grade in the course.