Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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],

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]}

numbers=['none','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve']

block = block.lower().strip()

details = board[block]

prop_total = details[0]

cost = details[1]

print("There are", numbers[prop_total], "properties and each house costs", cost)

print("How many houses are already present on these properties?")

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

print("You can build",numbers[max_houses], "house(s) --",numbers[prop_less] , "will have",numbers[less_houses], "and", numbers[prop_more], "will have",numbers[more_houses])

image text in transcribed

Sometimes there are houses already present, that will be added to. Allow the user to input the number of houses on each property already. There may be houses on multiple properties, so there may be more than one input value given. For example nich color block will you be building on? dark blue How much money do you have to spend 250 There are two properties and each house costs 200 How many houses are already present on these properties? 11 You can build one house(s) one wil1 have one and one will have two. h color block will you be building on? orange How much money do you have to spend? 46 There are three properties and each house costs 100 How many houses are already present on these properties? 1 1 2 You can build four house(s) one will have two and tNo will have three Partial credit will be given for any solution that yields correct results; full credit will only be given if the problem is still solved without any conditional expressions or loops. Hint: The following would request the Python IDLE environment for more information about how to input more than one value at once. Feel free to ask for help in deciphering the documentation. help str.split) help(map) will allow inputting 0, 1,2, or 3 values all at once will help converting inputs to numbers to add them up Sometimes there are houses already present, that will be added to. Allow the user to input the number of houses on each property already. There may be houses on multiple properties, so there may be more than one input value given. For example nich color block will you be building on? dark blue How much money do you have to spend 250 There are two properties and each house costs 200 How many houses are already present on these properties? 11 You can build one house(s) one wil1 have one and one will have two. h color block will you be building on? orange How much money do you have to spend? 46 There are three properties and each house costs 100 How many houses are already present on these properties? 1 1 2 You can build four house(s) one will have two and tNo will have three Partial credit will be given for any solution that yields correct results; full credit will only be given if the problem is still solved without any conditional expressions or loops. Hint: The following would request the Python IDLE environment for more information about how to input more than one value at once. Feel free to ask for help in deciphering the documentation. help str.split) help(map) will allow inputting 0, 1,2, or 3 values all at once will help converting inputs to numbers to add them up

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

Step: 3

blur-text-image

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

2. Why is resilience sometimes described as ordinary magic?

Answered: 1 week ago