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

You have three friends who want to rent a room in your house. The amount they ar

ID: 3938570 • Letter: Y

Question

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" Name your file Lastname_Firstname.py

Explanation / Answer

bills_rate = 100.0
johns_rate = 1000.0
kates_rate = 0.01
number_of_days = int(input("Enter the number of days: "))
bills_pay = 0.0
johns_pay = 1000.0
kates_pay = 0.01
#print(number_of_days)
bills_pay = bills_rate * number_of_days

for i in range(1,number_of_days) :
    johns_pay += johns_rate
    johns_rate /= 2
    #print(johns_pay)
    kates_pay += kates_rate
    kates_rate *= 2
    #print(kates_pay)

if (bills_pay > johns_pay) and (bills_pay > kates_pay) :
    print("Bill")
elif (johns_pay > kates_pay) :
    print("John")
else :
    print("Kate")

#print("Bill: %d, John: %d, Kate: %d" %(bills_pay,johns_pay,kates_pay))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote