Python function question: Find the value of n when c*n > a + b*n is satisfied

Asked 2 years ago, Updated 2 years ago, 14 views

When you create a function and enter values a, b, and c, How do you find the n value when you satisfy c*n > a + b*n?

I'll send you a coffee gifticon

python

2022-09-20 19:16

2 Answers

def stupid_way(a, b, c, n=0):
    if c*n > a + b*n :
        return n
    else:
        try:
            return stupid_way(a, b, c, n+1)
        except:
            return False

print(stupid_way(17, 17, 18))


2022-09-20 19:16

I wrote it like this before I read the answer. Thank you for participating ㅠ<


2022-09-20 19:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.