Rice bags

Write code · Challenge · §2.3 Turning conditions into code

You deliver exactly n kg of rice in 3 kg bags and 5 kg bags. You may use any number of each kind, including none of one kind. Complete the function solution, which returns the smallest number of bags you can use.

If you cannot make exactly n kg, return -1.

Function

solution(n)

Constraints

Examples

nresult
184
4-1

Starter code

def solution(n):
    answer = -1
    return answer

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.