Water Overflow Python
PROGRAM TO CHECK IF TANK WILL OVERFLOW, UNDERFLOW OR FILLED IN GIVEN TIME
OUTPUT:
Underflow
# function to calculate the volume of tankdef volume(radius, height): return ((22 / 7) * radius * radius * height) # function to print overflow / filled /# underflow accordinglydef check_and_print( required_time, given_time): if required_time < given_time: print( "Overflow") elif required_time > given_time: print("Underflow") else: print("Filled")# driver coderadius = 5 # radius of the tankheight = 10 # height of the tankrate_of_flow = 10 # rate of flow of water given_time = 70.0 # time given # calculate the required timerequired_time = volume(radius, height) /rate_of_flow # printing the resultcheck_and_print(required_time, given_time)
Underflow
Comments
Post a Comment