Learn

needs_water()

Instructions

1.

Define a function needs_water() that accepts:

  • First argument: An int number of days since the previous watering.
  • Second argument: A bool value is_succulent. (A value of true would indicate that the plant is a succulent.)

Inside the function, you’ll need some conditional logic:

  • If is_succulent is false and days is greater than 3, return "Time to water the plant.".
  • If is_succulent is true and days is 12 or less, return "Don't water the plant!".
  • If is_succulent is true and days is greater than or equal to 13, return "Go ahead and give the plant a little water.".
  • Otherwise, return "Don't water the plant!".

Note: Don’t print the strings; return them from the function.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?