Quize_creator
Shivam Malviya
@Intern at Sunderkiran Management Services | CSE-AIML(2026)|Creator of ResultShodh & MyUpasthiti Website???| AI & ML Enthusiast??| Full-Stack Developer??| Passionate Innovator??| Open to Collaborations & Opportunities??
you can check full code here????????
def select(val1, val2, op1, op2, i):
print("Enter 1 to perform addition")
print("Enter 2 to perform subtraction")
print("Enter 3 to perform multiplication")
print("Enter 4 to perform division")
choice = int(input("Write your choice: "))
if choice == 1:
print("Enter two numbers for addition")
val1 = int(input("val1: "))
val2 = int(input("val2: "))
print("Enter options here")
op1 = int(input("op1: "))
op2 = int(input("op2: "))
print()
print(f"Question no.{i}")
print(f"What is the addition of {val1} and {val2}")
print(f"Option1: {op1}\nOption2: {op2}")
answer = val1 + val2
elif choice == 2:
print("Enter two numbers for subtraction")
val1 = int(input("val1: "))
val2 = int(input("val2: "))
print("Enter options here")
op1 = int(input("op1: "))
op2 = int(input("op2: "))
print()
print(f"Question no.{i}")
print(f"What is the subtraction of {val1} and {val2}")
print(f"Option1: {op1}\nOption2: {op2}")
answer = val1 - val2
elif choice == 3:
print("Enter two numbers for multiplication")
val1 = int(input("val1: "))
val2 = int(input("val2: "))
print("Enter options here")
op1 = int(input("op1: "))
op2 = int(input("op2: "))
print()
print(f"Question no.{i}")
print(f"What is the multiplication of {val1} and {val2}")
print(f"Option1: {op1}\nOption2: {op2}")
answer = val1 * val2
elif choice == 4:
print("Enter two numbers for division")
val1 = int(input("val1: "))
val2 = int(input("val2: "))
print("Enter options here")
op1 = int(input("op1: "))
op2 = int(input("op2: "))
print()
print(f"Question no.{i}")
print(f"What is the division of {val1} and {val2}")
print(f"Option1: {op1}\nOption2: {op2}")
answer = val1 / val2
else:
print("Choose the correct operation")
return 0
user_answer = int(input("Enter your answer: "))
if user_answer == answer:
print("Congratulations, your answer is correct")
else:
print("Wrong answer")
print(f"Correct answer is: {answer}\n")
if answer == op1:
return op1
elif answer == op2:
return op2
else:
return 0
def main():
qn = int(input("How many questions do you want to create?: "))
for i in range(1, qn + 1):
answer = select(0, 0, 0, 0, i)
print("_END_")
s = int(input("If you want to create more questions, press 22: "))
if s == 22:
main()
else:
return -1
if __name__ == "__main__":
main()
#check output in your way.