Question: can get the code to compile in python block = input(Which color block will you be building on? ) money = int(input(How much money do
can get the code to compile in python
block = input("Which color block will you be building on? ")
money = int(input("How much money do you have to spend? "))
board = {'purple':[2,50], 'light blue':[3,50], 'maroon':[3,150] , 'orange':[3,100],'red':[3,150],'yellow':[3,150],'green':[3,200],'dark blue':[2,200]}
prop_total = board[block][0]
cost = board[block][1]
print("There are", prop_total, "properties and each house costs", cost)
max_houses = money//cost
# No. of houses in prop_less properties
less_houses = max_houses // prop_total
# No. of houses left
rem_houses = max_houses%prop_total
# No. of houses in prop_more properties
more_houses = less_houses+1
# No. of properties having more_houses
prop_more=rem_houses
# No. of properties having less_houses
prop_less = prop_total-prop_more
final= more_houses
print("You can build", max_houses, "house(s) --", prop_less , "will have", less_houses, "and", prop_more, "will have", final )
the
output should look like this
Which color block will you be building on? orange How much money do you have to spend 86 There are three properties and each house costs 180 You can build eight house(s) - one will have two and two will have three Which color block will you be building on? dark blue How much noney do you have to spend? 250 There are tso properties and each house costs 280 You can build one house(s)one will have none and one will have one (s) each
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
