반응형
You have an award-winning garden and every day 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!
Solution:
def rain_amount(mm: int, need: int = 40) -> str:
if result := need-mm > 0 and f"You need to give your plant {need-mm}mm of water": ...
elif result := "Your plant has had more than enough water for today!": ...
return result
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
1103. Welcome! (0) | 2022.11.04 |
---|---|
1102. Welcome to the City (0) | 2022.11.02 |
1031. Vowel remover (0) | 2022.10.31 |
1030. How many stairs will Suzuki climb in 20 years? (0) | 2022.10.30 |
1029. Printing Array elements with Comma delimiters (0) | 2022.10.29 |