반응형
Your function takes two arguments:
- current father's age (years)
- current age of his son (years)
Сalculate how many years ago the father was twice as old as his son (or in how many years he will be twice as old). The answer is always greater or equal to 0, no matter if it was in the past or it is in the future.
Solution:
def twice_as_old(dad_years_old, son_years_old): return abs(dad_years_old - son_years_old*2)
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
1004. Keep up the hoop (0) | 2022.10.04 |
---|---|
1003. Find the Remainder (0) | 2022.10.03 |
1001. Hello, Name or World! (0) | 2022.10.02 |
0930. Count of positives, sum of negatives (0) | 2022.09.30 |
0929. Summing a number's digits (0) | 2022.09.29 |