جواب «Pocket Money» چالش 8 از جلسهی 7
سؤال
ربات پسانداز: میپرسد How much do you save each week? و بعد How many weeks?. جمع پول را حساب میکند. اگر ۱۰۰ یا بیشتر بود بگوید In <هفته> weeks you will have <جمع>. You can buy the game! وگرنه In <هفته> weeks you will have <جمع>. Keep saving!. برای 20 و 6: In 6 weeks you will have 120. You can buy the game!
راهنما
total = money * weeks و بعد if total >= 100:. هر دو جواب با f نوشته میشوند.
یک جواب درست
import bot
print("How much do you save each week?")
money = int(input())
print("How many weeks?")
weeks = int(input())
total = money * weeks
if total >= 100:
print(f"In {weeks} weeks you will have {total}. You can buy the game!")
else:
print(f"In {weeks} weeks you will have {total}. Keep saving!")
اول خودت امتحان کن؛ جوابهای دیگر هم قبول است. برگرد و خودت حلش کن