# Mathematics Game
#By: Wilson
fromtimeimportsleepimportrandomfromrandomimportrandintasRnum1=R(1,50)num2=R(1,50)game=Truechances=5answered_correct=0score=0bonus_chance=0myfruits=["🍏","🍊","🍋","🍄","🍅","🍆","🍉","🍐","🍑","🍒","🍇","🍓"]arithmetic=["✖","➗","➕","➖"]level=["basic","intermediate","advanced"]stage=level[0]whilechances>0:#basic
ifstage==level[0]:num1=R(1,12)num2=R(1,2)#intermediate
ifstage==level[1]:num1=R(13,20)num2=R(13,20)#advanced
ifstage==level[2]:num1=R(21,100)num2=R(21,100)operation=arithmetic[R(0,3)]ifoperation==arithmetic[0]:result=num1*num2print("\n\n◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻\n")print("",num1,"",operation,"",num2," = ?")print("\n◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻\n")ifoperation==arithmetic[1]:result=int(num1/num2)print("\n\n◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻\n")print("",num1,"",operation,"",num2," ≈ ?")print("\n◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻\n")ifoperation==arithmetic[2]:result=num1+num2print("\n\n◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻\n")print("",num1,"",operation,"",num2," = ?")print("\n◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻\n")ifoperation==arithmetic[3]:result=num1-num2print("\n\n◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻\n")print("",num1,"",operation,"",num2," = ?")print("\n◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻◻\n")entry=input("\n🙎 Your Answer: ")ifentry=="q"orentry=="quit"orentry=="exit":break#if correct..
ifint(entry)==result:print("◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼")print("\n 🙆 Right!! 🍍🍋🍉")print("\n◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼\n")sleep(0.6)score+=R(5,20)answered_correct+=1sleep(0.8)print("💰💰 Score: 💲",score," ⭐Correct: ",answered_correct)bonus_chance+=R(5,10)# levels eventually increase
# over correct answers.
ifanswered_correct==5andanswered_correct<=10:stage=level[1]print("\n\n◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼\n\n")print(stage,"🔓 level unlocked! 👏\n\n")print("\n◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼\n\n")sleep(2)print("\n▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫\n")print("\n 🙋 Good luck!")print("\n▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫\n")ifanswered_correct>=8:stage=level[2]print("\n\n◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼\n\n")print(stage,"🔓 level unlocked! 👏\n\n")ifbonus_chance>=R(70,100):bonus_chance=0chances+=1sleep(1)print("◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼")print("\n\n\n***[ BONUS LIFE++ ]***\n\n")print(" Chances: ",chances,"\n\n")print(" BONUS SCORE: 100+\n\n")print("◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼")score+=100sleep(2)ifint(entry)!=result:sleep(0.8)print("\n❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌\n")print(" 🙍 Wrong 🚨 \n")print("❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌\n")chances-=1sleep(0.5)print(" Chances Left: ",chances)sleep(2)ifstage==level[2]andabs(int(entry-result))<5:print("clode enought..")# game over when chances < 1
print("\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")print("\n GAME OVER")print(" SCORE: ",score)print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:
Ensure the proper functioning of the site (essential cookies); and
Track your browsing to send you personalized communications if you have created a professional account on the site and can be contacted (audience measurement cookies).
With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.