Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An apartment complex charges monthly rental fees based on the floor of the apartment. Write a python program that uses a loop to prompt for

An apartment complex charges monthly rental fees based on the floor of the apartment. Write a python program that uses a loop to prompt for 3 customer names and the floor of their apartment. Use the apartment floor to determine the monthly rent for each customer using the table below. Your program should also determine the highest floor of the 3 customers and average floor for the 3 customers. The program should display each customer name & monthly rent. Also output the average floor of the 3 and highest floor of the 3. Write the Python code to display the Test Data results

I NEED THE CODE TO BE BASED OFF MINE, I JUST NEED MY CODE FIXED.

Floor

Monthly Rent

1 to 3

$1200

4 to 6

$ 1500

7 to 9

$2000

10

$3500

TEST DATA

Customer Name

Floor

Katia

5

Omar

2

Dominic

10

THE CODE I HAVE THAT DOESNT WORK:

floor_number = 0 rent_cost = 0 total_floors = 0 Floors = [] Rent = [] Names = [] a = 0

while ( a < 2): name1 = input("Please enter your name: ") Names.append(name1) floor_number = input("Please enter your floor number: ") Floors.append(floor_number) floor_number += (str(total_floors))

if (floor_number >= 1): print("Your rent is: $1200") rent_cost = "$1200" elif (floor_number > 3): print("Your rent is: $1500") rent_cost = "$1500"

elif(floor_number > 6): print("Your rent is: $2000") rent_cost = "$2000"

elif(floor_number > 9): print("Your rent is: $3500") rent_cost = "$3500"

Rent.append(rent_cost) a += 1

i = 0 while( i < len(Names)): print(Names[a], "-----", Rent[a]) i += 1

print("The average floor is: ", total_floors/3) print("The highest floor is: ", max(Floors))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

Did the team members feel that their work mattered

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago