0

Fixed* Write a program to determine how many gallons of water it would take to fill your pool if it were perfectly rectangular

I keep getting a syntax error Here is my code #pool dimensions #volume of pool def getVolumeofPool(length, width, depth): pool_volume = pool_length*pool_width*pool_height return pool_volume #Method to calculate and return the total gallons of water required in the pool #based on inpit volume of pool and gallons of water in cubic meter def getWaterRequiredinPool(pool_volume, gallons,_per_cubic_m): gallons_used = pool_length*pool_width*pool_height return gallons_used #Method to calculate and return the water bill based on input #number of gallons of water and cost per unit of gallon def getWaterBill(water_gallons, cost_unit_gallo): water_cost = water_gallons*cost_unit_gallon return water_cost #main method def main(): #declare constants #change the constant values with the #actual values gallons_water_per_cubic_meter = 264.17 cost_per_gallon_water = 1.5/100 #input pool dimensions length = float(input('10:') width = float(input('5:') depth = float(input('5:') #calculate volume of pool pool_volume = getVolumeOfPool(length, width, depth) #calculate the total gallons of water required to fill pool gallons_used = getGallonsofWaterRequiredInPool(pool_volume, \ GALLONS_WATER_PER_CUBIC_METER) #calculating water bill water_cost = getWaterBill(total_water_gallons, COST_PER_GALLON_WATER) #print results print('\nVolume of the pool is: %.2f cubic meter'%(pool_volume)) print('Gallons of water needed to fill the pool is: %.2f'% \ total_water_gallons) print('Total water bill to fill the pool \nat a rate of $%.2f per 1000 gallons is: $%.2f' \ %((COST_PER_GALLON_WATER*1000), water_bill)) main()

26th May 2020, 9:33 PM
Peyson
 Peyson  - avatar
6 odpowiedzi
+ 1
Thank you! This my first day of coding and its all a lot right now. i appreciate you taking the time to comment.
26th May 2020, 9:39 PM
Peyson
 Peyson  - avatar
+ 1
will fix now thank you!
26th May 2020, 9:43 PM
Peyson
 Peyson  - avatar
+ 1
I know how difficult programming can be at first. A pleasure to help you.
26th May 2020, 9:56 PM
Josshual A. Toro M.
Josshual A. Toro M. - avatar
0
It is somewhat complex what they ask of you, although they give you free will. To calculate the area of a rectangle the formula is: b * h in two dimensions, however you need to calculate a volume that is given by b * h * l Where: b = base h = height l = length After applying this formula, it should give you cm ^ 3 (in Venezuela we work with the international system). Then it would depend on how much you enter. It was not very difficult to make the code, it seems to me that you are not looking for too much information. Try to see what I did. NOTE: You just need to multiply the gallons of water by the cost (you decide how much it is worth). https://code.sololearn.com/cYjVTa4AhxYI/?ref=app
26th May 2020, 9:36 PM
Josshual A. Toro M.
Josshual A. Toro M. - avatar