Will the Quota Last? چالش 4 از جلسهی 46، متوسط
سه تابع بنویس:
- daily_tokens(users, questions_each, tokens_each): حاصلضرب هر سه.
- fits(users, questions_each, tokens_each, limit): True اگر توکن روزانه <= limit بود.
- max_questions(users, tokens_each, limit): هر نفر حداکثر چند سؤال در روز (limit // (users * tokens_each)).
خروجی test: 75000، True، False، 13.
def daily_tokens(users, questions_each, tokens_each):
return 0
def fits(users, questions_each, tokens_each, limit):
return True
def max_questions(users, tokens_each, limit):
return 0
# ---- test (do not change) ----
print(daily_tokens(25, 10, 300))
print(fits(25, 10, 300, 100000))
print(fits(25, 20, 300, 100000))
print(max_questions(25, 300, 100000))
راهنما و جواب این چالش · برگشت به درس جلسهی 46: پروژهی نهایی ۱: نقشه · چالش بعدی: The Biggest Risks First
بیشتر بخوان: تابع در پایتون: آموزش def، پارامتر و return با مثال