Problem 1. Budgeted vs. Actual Expenses Write program that asks the user to enter the amount that he or she has budgeted for a month. Using a while loop, the user should be prompted to enter each of his or her expenses for the month and keep a running total. When the loop finishes, the program should display the amount that the user is over or under budget. Design. Use an IPO diagram to design your program. See IPO diagram attached to this assignment. Code. Write your program in Python using the above steps. Save your program as a .py file with the name yourlastname Lab4.1.py Output. Your ogram should produce correctly labeled output with dollar amounts rounded to 2 decimal places and dollar signs. Sample dialog: Enter amount budgeted for the month: 500 Enter an amount spent (0 to quit): 50 Enter an amount spent (0 to quit): 75 spent (0 to quit): 800 spent (0 to quit): 23.95 Enter an amount Enter an amount Enter an amour spent (0 to quit): 0 Budgeted: $ 500.00 Spent: $948.95 You are $ 448.95 over budget. PLAN BETTER NEXT TIME!
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
![Problem 1. Budgeted vs. Actual Expenses
Write program that asks the user to enter the amount that he or she has budgeted for a month.
Using a while loop, the user should be prompted to enter each of his or her expenses for the
month and keep a running total. When the loop finishes, the program should display the amount
that the user is over or under budget.
Design. Use an IPO diagram to design your program. See IPO diagram attached to this assignment.
Code. Write your program in Python using the above steps. Save your program as a py file with the
name yourlastname lab4.1.py
Output. Your program should produce correctly labeled output with dollar amounts rounded to 2
decimal places and dollar signs. Sample dialog:
Enter amount budgeted for the month: 500
Enter an amount spent (0 to quit): 50
Enter an amount
spent (0 to quit): 75
Enter an amount
spent (0 to quit): 800
Enter an amount
spent (0 to quit): 23.95
Enter an amount spent (C to quit): 0
Budgeted: $ 500.00
Spent: $948.95
You are $448.95 over budget. PLAN BETTER NEXT TIME!
Problem 2. Ocean Levels
Assuming the ocean's level is currently rising at about 1.8 millimeters per year, create an application
that displays the number of millimeters that the ocean will have risen each year for the next 25
years, You must use a loop to create the data output.
Focus
6-17 PM
Y
100%](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5d570369-f021-4a4c-bd42-feb213820226%2F4f59b16d-0ccb-4f04-961c-0578f306bc17%2F82ap8x_processed.jpeg&w=3840&q=75)
![Year
1
2
3
1
4
C
5
10
7
2
8
10
2322987222
12
16
17
18
20
24
Rise (in millimeters)
1.80
3.60
5.40
7.20
19.00
10.80
12.60
14.40
16.20
Found
18.00
19.80
21.60
23.40
25.20
27.00
28.80
30.60
32 40
34.20
36.00
37.80
39.60
41.40
43.20
45.00
Programming Style Requirements.
Comments - Both inline comments and header are required, as usual.
Variable names - use meaningful variable names such as total taxes or num cookies.
Named constants - Use named constants for all number values that will not be changed in the
program such as RECIPE SUGAR = 1.5. See section 2.9 on Named Constants
Ben Fra
EF](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5d570369-f021-4a4c-bd42-feb213820226%2F4f59b16d-0ccb-4f04-961c-0578f306bc17%2Fjo76r5_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)