Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python Program help: You have three friends who want to rent a room in your hous

ID: 3937875 • Letter: P

Question

Python Program help:


You have three friends who want to rent a room in your house. The amount they are willing to pay you depends on the length of their stay.

Bill will pay you a flat rate of $100 dollars every day.

John will pay you $1000 dollars the first day and half as much each subsequent day, meaning on the first day he will pay $1000, the second day he will pay $500, on the third day he will pay $250 etc.

Kate will pay $0.01 on the first day and then twice as much on each subsequent day, meaning on the first day she will pay $0.01, on the second day she will pay $0.02, on the third day she will pay $0.04 etc.

You need to write a program that takes the input from a user consisting of number of days a person will rent your room. You will print a string of the name of which tenant will pay the most. For example: when number of days entered = 1, you would print the string “John”

Explanation / Answer

def Maximum(a, y, z):#Function to find max among 3 numbers
Max = a
name=""
if y > Max:
Max = y
name="John"   
if z > Max:
Max = z
name="Kate"
if y > z:
Max = y
name="Bill"
print Max
print name

print "Enter number of days"
day=input()
Bill=100
John=1000
Kate=0.01

#Final rent paide by all 3
Bill_pay=0
John_pay=0
Kate_pay=0
for x in range(day):
   Bill_pay=Bill_pay+Bill
  
   John_pay=John_pay+John
   John=John/2 #John decreases payment /2

   Kate_pay=Kate_pay+Kate
   Kate=Kate*2#Kate increases payment *2


Maximum(Bill_pay,John_pay,Kate_pay)

======================================

akshay@akshay-Inspiron-3537:~/Chegg$ python room.py
Enter number of days
1
1000
John