Is my function correct?
def save(amount):
if amount >= 100:
return amount + 10
else:
return amount
1 answers ( 0 marked as helpful)
Hi Phongrada!
Thanks for reaching out.
Your Python code is correct. The code defines a function named save
that takes an argument amount
. It checks if the amount is greater than or equal to 100 using the if
statement. If it is, the function returns the amount plus 10. Otherwise, if the amount is less than 100, the function simply returns the original amount without any modifications.
Best,
Ivan