Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
float parameter
#1
An Olympic-size swimming pool is 25 meters wide and 50 meters long (rectangular). The minimum of depth of the pool is 2 meters. So I need to write a function that takes a float parameter (depth) and return the volume of the pool. If the depth does not meet the minimum depth requirement of Olympic-size pool, return zero.
here is my code:
def pool_volume(depth):
x=float(x)
if x<2 :
return 0
else:
return 25*50*x
What is the mistake?
Reply
#2
def pool_volume(depth):
    
    if depth>=2:
        return 25*50*depth
    else:
        return 0
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020