Learn
needs_water()
Instructions
1.
Define a function needs_water()
that accepts:
- First argument: An
int
number ofdays
since the previous watering. - Second argument: A
bool
valueis_succulent
. (A value oftrue
would indicate that the plant is a succulent.)
Inside the function, you’ll need some conditional logic:
- If
is_succulent
isfalse
anddays
is greater than3
, return"Time to water the plant."
. - If
is_succulent
istrue
anddays
is12
or less, return"Don't water the plant!"
. - If
is_succulent
istrue
anddays
is greater than or equal to13
, 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
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.