06 Feb Friday 17:00 Python Homework 22.02.04
Question 1.
Write a program that helps the user add up her change. The program should ask:
- “How many quarters?”
- “How many dimes?”
- “How many nickels?”
Then it should give the total value of the change
Sample Input: How many quarters? 1 How many dimes? 2 How many nickels? 4 Sample Output: The total is $0.65
Question 2:
Write a program to help you feed your friends at a party by doing some math about square pizzas. Your program need use input to ask the side length of the square pizza in cm. The area of the pizza should be computed using the formula Area = side length * side length. Then, assuming that each person needs to eat 100 cm2 of pizza, calculate the number of people it can feed.
Sample Input: Side length of the square pizza: 17.5 Sample Output: 3
Explanation and Hint:
If the side length is 17.5, the area will be 306.25 cm2, so 3 is the correct output, because it 3 persons need to eat 300 cm2 in total. You can get this result by using int(), for example:
people = int(306.25 / 100)
this will help you round down the result into 3
Sorry, the comment form is closed at this time.