N = 18
F = 5
T = 3
bags = 0

while N >= 0:
    if N % F == 0:
        bags += N // F
        break
    N -= T
    bags += 1

print(bags)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: