def quiz():
print("Quiz time!")
print("Q1:What is the result of x when x^0.5=2\n (a).4 (b).-4 (c).Both a and b (d).No solution")
a1=input("Q1:Your answer:")=="a"
print("Correct!\n" if a1==1 else "No.\n")
print("Q2:What is the number in the units digit of 2022! ?\n (a).2 (b).4 (c).0 (d).8")
a2=input("Q2:Your answer:")=="c"
print("Correct!\n" if a2==1 else "No.\n")
print("Q3:What is the approximate world population in November 2022?\n (a).80billion (b).8billion (c).60billion (d).800million")
a3=input("Q3:Your answer:")=="b"
print("Correct!\n" if a3==1 else "No.\n")
print("Q4:A={1,3,5,7},B={-2,-4,6,-8}. Please figure out the result of '(The complement of (A ∩ B)) ∩ ((The complement of A) ∩ B)' ?\n (a).A (b).B (c).R (d).{}")
a4=input("Q4:Your answer:")=="c"
print("Correct!\n" if a4==1 else "No.\n")
print("Q5:Which is the largest freshwater lake in the world?\n (a).Caspian Sea (b).Qinghai Lake (c).Lake Superior (d).Black Sea")
a5=input("Q5:Your answer:")=="c"
print("Correct!\n" if a5==1 else "No.\n")
a=a1+a2+a3+a4+a5
if(a==5):
print("Congratulations!")
elif(a==4):
print("Great!")
elif(a==3):
print("Not so bad!")
elif(a==2):
print("You can be better!")
elif(a==1):
print("Keep on fighting!")
else:
print("Make persistent efforts!")
print("You get "+str(a)+" out of 5!")
print("That is a score of "+str(a/5*100)+" percent.")
def game():
print("GAME LOADING...")
import random
min=int(input("What is the lower bond of the number?\n"))
max=int(input("What is the lower bond of the number?\n"))
print(f"Generating a random number between {min}-{max}...\n")
x=random.randint(min,max)
times=int(input("How many tries for the player to win?\n"))
print("GAME READY. Now let's play!\n")
name=input("\nHello, What's your name?\n")
print(f"\nHi {name}, you are going to guess a number between {min} and {max}.\nYou have {times} tries to win the game.\n")
for i in range(times):
y=int(input(f"Your {i+1} guess is:"))
if(x>y):
print("Your guess is too low!\n")
elif(x<y):
print("Your guess is too high!\n")
else:
print(f"You win the game in {i+1} tries!")
break
i+=1
if(x!=y):
print(f"The answer is {x}! You lose the game!")
print(">>> Quiz")
quiz()
print(">>> Guessing Game")
game()