You have an award-winning garden and everyday the plants need exactly 40mm of water. You created a great piece of JavaScript to calculate the amount of water your plants will need when you have taken into consideration the amount of rain water that is forecast for the day. Your jealous neighbour hacked your computer and filled your code with bugs. 

Your task is to debug the code before your plants die!

Difficulty: introductory

Starter code:

def rain_amount(mm):
	

Solutions:
def rain_amount(mm):
    if mm < 40:
             return "You need to give your plant " + str(40 - mm) + "mm of water"
    else:
             return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
        return 'You need to give your plant {}mm of water'.format(40 - mm)
    return 'Your plant has had more than enough water for today!'


def rain_amount(rain_amount):
    if rain_amount < 40:
        return "You need to give your plant " + str(40 - rain_amount) + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm < 40):
         return f"You need to give your plant {40-mm}mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm >= 40:
        return "Your plant has had more than enough water for today!"
    else:
        return "You need to give your plant %smm of water" % (40 - mm)

def rain_amount(rain_amount):
    if rain_amount < 40:
         return "You need to give your plant " + str(-rain_amount + 40) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm>=40:
        return "Your plant has had more than enough water for today!"
    return "You need to give your plant " + str(40-mm) + "mm of water"


def rain_amount(mm):
    if mm < 40:
        return "You need to give your plant " + str(40 - mm) + "mm of water"
    return "Your plant has had more than enough water for today!"

rain_amount = lambda m: ["Your plant has had more than enough water for today!", "You need to give your plant {}mm of water"][m<40].format(40-m)

def rain_amount(mm):
    if mm < 40:
         return "You need to give your plant %dmm of water" %(40 - mm)
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm: int) -> str:
    """
    Get the amount of water your plants will need when you have taken into 
    consideration the amount of rain water that is forecast for the day.
    """
    return {
        mm < 40: f"You need to give your plant {40 - mm}mm of water"
    }.get(True, f"Your plant has had more than enough water for today!")

rain_amount=lambda n:n<40 and 'You need to give your plant '+str(40-n)+'mm of water' or 'Your plant has had more than enough water for today!'

def rain_amount(mm):
    if mm < 40:
        a = "You need to give your plant "
        b = "mm of water"
        s = ""
        s += a
        st = 40 - mm
        st = str(st)
        s += st
        s += b
        return s
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm < 40):
        return f"You need to give your plant " + str(abs(mm - 40)) + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm >= 40):
        return "Your plant has had more than enough water for today!"   
    else:
        return f"You need to give your plant {abs(mm - 40)}mm of water"

def rain_amount(mm):
    if  mm == 40:
        return "Your plant has had more than enough water for today!"
    if mm > 40:
        return "Your plant has had more than enough water for today!"
    if mm < 40:
        return f"You need to give your plant {40 - mm}mm of water"
        


def rain_amount(m):
    if m >= 40:
        return "Your plant has had more than enough water for today!"
    else:
          return f"You need to give your plant {40-m}mm of water"

def rain_amount(mm):
    if mm >= 40:
        return "Your plant has had more than enough water for today!"
    if mm <= 40:
         return "You need to give your plant " + str(40 - mm) + "mm of water"

def rain_amount(rain_amount):
    if rain_amount < 40:
         return "You need to give your plant "  + f"{40-rain_amount}mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm < 40):
         return f"You need to give your plant {str(40-mm)}mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(rm):
    if (rm < 40):
        return "You need to give your plant {r}mm of water".format(r=-rm+40)
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm-40<0:
         return "You need to give your plant " + str(40-mm) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

rain_amount = lambda  mm: f'You need to give your plant {40-mm}mm of water' if mm < 40 else 'Your plant has had more than enough water for today!'

def rain_amount(mm):
    rain = 40 - mm
    rain = str(rain)
    if mm < 40:
          return("You need to give your plant " + rain + "mm of water")
    
    else:
        return( "Your plant has had more than enough water for today!")

def rain_amount(rain_amount):
    if rain_amount >= 40:
        return "Your plant has had more than enough water for today!"
    return "You need to give your plant " + str(40 - rain_amount) + "mm of water"


def rain_amount(mm):
    return "Your plant has had more than enough water for today!" if mm >= 40 else f'You need to give your plant {40 - mm}mm of water'

def rain_amount(mm):
    return "Your plant has had more than enough water for today!" if mm>40 else "Your plant has had more than enough water for today!" if mm==40 else "You need to give your plant {}mm of water".format(str(40-mm))

def rain_amount(water):
    if water < 40:
         return "You need to give your plant " + str((40 - water)) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    r = str(40 - mm)
    if mm < 40:
         return "You need to give your plant " + r + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm < 40):
        return f"You need to give your plant {-(mm - 40)}mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if not (mm >= 40):
         return f"You need to give your plant {abs(mm - 40)}mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(rain):
    if (rain < 40):
         return f"You need to give your plant {40 - rain}mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm > 39: return 'Your plant has had more than enough water for today!'
    return f'You need to give your plant {40 - mm}mm of water'


def rain_amount(mm):
    if mm >= 40:
        return "Your plant has had more than enough water for today!"
    return "You need to give your plant {0}mm of water".format(40 - mm)


def rain_amount(mm):

    rain_amount = 40
    
    if mm < rain_amount:
         return f"You need to give your plant {rain_amount - mm }mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm < 40):
        return f"You need to give your plant {str(40 - mm)}mm of water"
    else:
        return f"Your plant has had more than enough water for today!"

def rain_amount(mm):
    i = 40
    if (mm < 40):
        i = 40 - mm
        return "You need to give your plant " + str(i) + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
         return "You need to give your plant " + str(40 - mm) + "mm of water".format(mm)
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    return f"You need to give your plant {str(40 - mm)}mm of water"  if mm < 40 else "Your plant has had more than enough water for today!"

def rain_amount(rain_amount):
    if rain_amount < 40:
         return "You need to give your plant " + "{}" .format(40 - rain_amount) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm >= 40:
        return "Your plant has had more than enough water for today!"
    else:
        return f"You need to give your plant {40 - int(mm)}mm of water"



def rain_amount(mm):
    if (mm < 40):
         return "You need to give your plant {}mm of water".format(40- mm) # + {rain_amount - 40} + " mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm < 40):
         return "You need to give your plant " + f'{40 - mm}' + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(rain_amount):
    if (rain_amount < 40):
         return f"You need to give your plant {abs(rain_amount - 40)}mm of water"
    return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
        a = 40 - mm
        return "You need to give your plant {}mm of water".format(a)
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm == 40):
         return "Your plant has had more than enough water for today!"
    elif (mm > 40):
        return "Your plant has had more than enough water for today!"
    else:
        return f"You need to give your plant {40-mm}mm of water"



def rain_amount(mm):
    if (mm < 40):
         return f"You need to give your plant {abs(mm - 40)}mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):       
    s1 = "Your plant has had more than enough water for today!"
    return s1 if mm >= 40 else  f"You need to give your plant {40 - mm}mm of water"

def rain_amount(mm):
    if mm < 40:
        sum = mm - 40
        return "You need to give your plant " + str(abs(sum)) + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    f = str(40 - mm)
    c = "You need to give your plant "
    d = "mm of water"
    if mm <= 39:
         return c + f + d
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    return f"You need to give your plant {40 - mm}mm of water" if mm < 40\
           else "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
        return "You need to give your plant " + "{}".format(40 - mm) + "mm of water"
    elif mm >= 40:
         return "Your plant has had more than enough water for today!"

def rain_amount(rain_amount):
    if (rain_amount < 40):
        water = 40 - rain_amount
        return "You need to give your plant " + str(water) + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(rain_amount):
    if (rain_amount < 40):
         remaining = 40 - rain_amount
         return f'You need to give your plant {remaining}mm of water'
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    remaining_rain = 40 - mm
    if (mm < 40):
         return "You need to give your plant " + str(remaining_rain) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
         return "You need to give your plant {}mm of water".format(40 - mm)
#     if else:
    return "Your plant has had more than enough water for today!"

def rain_amount(rain_amount):
    if rain_amount == 40:
        return "Your plant has had more than enough water for today!"
    elif rain_amount > 40:
        return "Your plant has had more than enough water for today!"
    else:
        return "You need to give your plant " + str((40 - rain_amount)) + "mm of water"


def rain_amount(mm):
    needed_watering = 40 - mm
    if mm < 40:
        return "You need to give your plant {}mm of water".format(needed_watering)
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm >= 40:
        return "Your plant has had more than enough water for today!"
    return f"You need to give your plant {40 - mm}mm of water"

def rain_amount(mm):
    if mm >= 40:
         return "Your plant has had more than enough water for today!"
    return f'You need to give your plant {40 - mm}mm of water'
# Flez     


def rain_amount(rain_amount):
    if rain_amount < 40:
        return f"You need to give your plant {40 - rain_amount}mm of water"
    return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm >= 40:
         return "Your plant has had more than enough water for today!"
    elif mm < 40:
         return f"You need to give your plant {40-mm}mm of water"

def rain_amount(mm):
    if (mm >= 40): 
        return "Your plant has had more than enough water for today!"
    if (mm is not 40):
        remaining = (40 - int(mm))
        return "You need to give your plant {}mm of water".format(remaining)


def rain_amount(mm):
    if (mm < 40):
        return f"You need to give your plant {40 - mm}mm of water"
    else:
        return f"Your plant has had more than enough water for today!"

def rain_amount(mm):
    return f"You need to give your plant {40-mm}mm of water" if mm < 40 else "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
         return f"You need to give your plant {40 - mm}mm of water"
    return "Your plant has had more than enough water for today!"

def rain_amount(rain_amount):
    if (rain_amount < 40):
        return f"You need to give your plant {abs(rain_amount - 40)}mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(rain_amount):
    if rain_amount < 40:
         return f'You need to give your plant {40 - rain_amount}mm of water'
    else:
         return 'Your plant has had more than enough water for today!'

def rain_amount(mm):
    if mm >= 40: return 'Your plant has had more than enough water for today!'
    else: return f'You need to give your plant {40-mm}mm of water'

def rain_amount(mm):
    if 40>mm:
        return "You need to give your plant %imm of water" % (40-mm)
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
        return "You need to give your plant {:d}mm of water".format(40 - mm)
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
         return "You need to give your plant " + str(-mm + 40) + "mm of water"
    return "Your plant has had more than enough water for today!"

rain_amount = lambda mm: ('Your plant has had more than enough water for today!','You need to give your plant %dmm of water'%(40-mm))[mm<40]

def rain_amount(mm):
    if (mm >= 40):
         return "Your plant has had more than enough water for today!"
    elif (mm < 40):
         return ("You need to give your plant {}mm of water".format(40 - mm))

def rain_amount(mm):
    if mm < 40:
        water = 40-mm
        return "You need to give your plant " + str(water) + "mm of water"
    elif mm >= 40:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    rain_amount=40
    if mm < rain_amount:
         return "You need to give your plant {}mm of water".format(rain_amount-mm)
    return "Your plant has had more than enough water for today!"

def rain_amount(mm):
  
  if mm < 40:
    s =40 - mm
    return "You need to give your plant " + str(s) + "mm of water"
  elif mm >= 40:
    return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm >= 40: 
        return "Your plant has had more than enough water for today!"
    return "You need to give your plant {}mm of water".format(40-mm)
    


def rain_amount(mm):
    cat = 40 - mm
    dog = str(cat)
    if mm < 40:
        return "You need to give your plant " + dog + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm>=40:
        return "Your plant has had more than enough water for today!"
    else:
        m=40-mm
        return "You need to give your plant "+ str(m) + "mm of water"


def rain_amount(x):
    if x>39:
        return("Your plant has had more than enough water for today!")
    else:
        return("You need to give your plant "+str(40-x)+"mm of water")

def rain_amount(mm):
    if mm < 40:
        r = 40 - mm
        return "You need to give your plant " + str(r) + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(amount):
    if amount < 40:
         return "You need to give your plant {}mm of water".format((40 - amount))
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    fort = 40 - mm
    fort = str(fort)
    if (mm < 40):
        return "You need to give your plant " + fort + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    more = "You need to give your plant {amount}mm of water".format(amount = 40 - mm)
    enough = "Your plant has had more than enough water for today!"
    return more if mm < 40 else enough
    


def rain_amount(mm):
    return ("Your plant has had more "\
            "than enough water for today!",
            "You need to give your plant %d"\
            "mm of water" % (40 - mm))[mm < 40]

def rain_amount(m):
    if(m<40):
        b=40-m
        return "You need to give your plant " + str(b) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm < 40):
         return "You need to give your plant " + str(40-mm) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"
#Completed by Ammar on 25/8/2019 at 04:05AM.


def rain_amount(mm):
    if mm<40:
         return "You need to give your plant {}mm of water".format(40- mm)
    else:
         return "Your plant has had more than enough water for today!"
  #I solved this Kata on  8/25/2019  01:18 AM...#Hussam'sCodingDiary


def rain_amount(mm):
    #r = 40 - mm
    if mm < 40:
         return "You need to give your plant {}mm of water".format(40 - mm)
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm >= 40: return "Your plant has had more than enough water for today!"
    return "You need to give your plant %imm of water" % (40-mm)

def rain_amount(mm):
    if int(mm) < 40:
         return "You need to give your plant " + str(abs(int(mm) - 40)) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (mm < 40):
        sum=40 - mm
        return "You need to give your plant " + str(sum) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(rain):
    if rain >= 40:
         return "Your plant has had more than enough water for today!"    
    else:
         return "You need to give your plant {}mm of water".format(40-rain)



def rain_amount(rain):
    print(rain)
    if rain >= 40:
        return "Your plant has had more than enough water for today!"
    else:
        return "You need to give your plant " + str(40-rain) + "mm of water"


def rain_amount(x):
    if x < 40:
         return "You need to give your plant " + str(40-x) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if (40-mm>0):
         return "You need to give your plant " + str(40-mm) + "mm of water"
    else:
         return "Your plant has had more than enough water for today!"

def rain_amount(mm):
    if mm < 40:
        return 'You need to give your plant {water}mm of water'.format(water=40-mm)
    else:
        return "Your plant has had more than enough water for today!"

def rain_amount(mm, needs=40):
    water_amount = needs - mm
    if water_amount > 0:
        return "You need to give your plant " + str(water_amount) + "mm of water"
    else:
        return "Your plant has had more than enough water for today!"


def rain_amount(m):
   if m <40:
     return "You need to give your plant {}mm of water".format(abs(m - 40))
   else:
     return "Your plant has had more than enough water for today!"