반응형
You were camping with your friends far away from home, but when it's time to go back, you realize that your fuel is running out and the nearest pump is 50 miles away! You know that on average, your car runs on about 25 miles per gallon. There are 2 gallons left.
Considering these factors, write a function that tells you if it is possible to get to the pump or not.
Function should return true if it is possible and false if not.
Solution:
def zero_fuel(distance_to_pump, mpg, fuel_left):
return distance_to_pump <= mpg * fuel_left
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
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 |
1027. Filling an array (part 1) (0) | 2022.10.28 |
1026. Beginner Series #4 Cockroach (0) | 2022.10.26 |
1025. Exclusive "or" (xor) Logical Operator (0) | 2022.10.26 |