Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:12:33+00:00 2026-05-28T11:12:33+00:00

So I am creating a game where basically it asks people a few questions

  • 0

So I am creating a game where basically it asks people a few questions about what type of questions they want to answer and how many they want to answer and what not. I am having a problem figuring out how to random mathematical operations such as addition, multiplication, and subtraction in particular. Here is my whole code but the only part I am looking for help on is where it says “mixed” because I need to figure out how to mix the three operations.

import random
correct = 0

while True:
    questions = int(input("Enter the amount of questions would you like to answer: "))
    difficulty = input("Enter the difficulty of questions you would like: Beginner,    Intermediate, or Advanced: ")
math = input("Would you like to do addition, subtraction, multiplication, or mixed: ")

if difficulty == "Beginner":
    for i in range(questions):
        if math == "multiplication":
            beg1 = random.randint(1, 10)
            beg2 = random.randint(1, 10)
            prod = beg1 * beg2

            begAns = input("What is " + str(beg1) + " times " + str(beg2) + "? ")

            if int(begAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "subtraction":
            beg1 = random.randint(1, 10)
            beg2 = random.randint(1, 10)
            prod = beg1 - beg2

            begAns = input("What is " + str(beg1) + " minus " + str(beg2) + "? ")

            if int(begAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "addition":
            beg1 = random.randint(1, 10)
            beg2 = random.randint(1, 10)
            prod = beg1 + beg2

            begAns = input("What is " + str(beg1) + " plus " + str(beg2) + "? ")

            if int(begAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "mixed":
            beg1 = random.randint(1, 10)
            beg2 = random.randint(1, 10)
            prod = beg1 * beg2

            begAns = input("What is " + str(beg1) + " times " + str(beg2) + "? ")

            if int(begAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

elif difficulty == "Intermediate":
    for i in range(questions):
        if math == "multiplication":
            intermediate1 = random.randint(1, 25)
            intermediate2 = random.randint(1, 25)
            prod = intermediate1 * intermediate2

            intAns = input("What is " + str(intermediate1) + " times " + str(intermediate2) + "? ")

            if int(intAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "subtraction":
            intermediate1 = random.randint(1, 25)
            intermediate2 = random.randint(1, 25)
            prod = intermediate1 - intermediate2

            intAns = input("What is " + str(intermediate1) + " minus " + str(intermediate2) + "? ")

            if int(intAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "addition":
            intermediate1 = random.randint(1, 25)
            intermediate2 = random.randint(1, 25)
            prod = intermediate1 + intermediate2

            intAns = input("What is " + str(intermediate1) + " plus " + str(intermediate2) + "? ")

            if int(intAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "mixed":
            intermediate1 = random.randint(1, 25)
            intermediate2 = random.randint(1, 25)
            prod = intermediate1 + intermediate2

            intAns = input("What is " + str(intermediate1) + " times " + str(intermediate2) + "? ")

            if int(intAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod) 

elif difficulty == "Advanced":
    for i in range(questions):

        if math == "multiplication":
            adv1 = random.randint(1, 100)
            adv2 = random.randint(1, 100)
            prod = adv1 * adv2

            advAns = input("What is " + str(adv1) + " times " + str(adv2) + "? ")

            if int(advAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "subtraction":
            adv1 = random.randint(1, 100)
            adv2 = random.randint(1, 100)
            prod = adv1 - adv2

            advAns = input("What is " + str(adv1) + " minus " + str(adv2) + "? ")

            if int(advAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "addition":
            adv1 = random.randint(1, 100)
            adv2 = random.randint(1, 100)
            prod = adv1 + adv2

            advAns = input("What is " + str(adv1) + " plus " + str(adv2) + "? ")

            if int(advAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

        elif math == "mixed":
            adv1 = random.randint(1, 100)
            adv2 = random.randint(1, 100)
            prod = adv1 + adv2

            advAns = input("What is " + str(adv1) + " times " + str(adv2) + "? ")

            if int(advAns) == prod:
                print("That's right -- well done.\n")
                correct += 1
            else:
                print("No, I'm afraid the answer is ",prod)

else:
    print("Please enter Beginner, Intermediate, or Advanced.\n")


print("\nI asked you", questions, "questions. You got ", correct, " of them right.")

if correct / questions > 2/3:
    print("Well done.\n")
elif correct / questions > 1/3:
    print("You need more practice.\n")
else:
    print("Please ask your math teacher for help!\n")

restart = input("Would you like to play again? Y/N: ")
if restart == "Y":
    continue
elif restart == "N":
    break
else:
    print("Please Enter Y or N")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:12:34+00:00Added an answer on May 28, 2026 at 11:12 am

    To randomly choose one of +, -, or * and apply it to two numbers:

    import random
    from operator import add, sub, mul
    
    ops = (add, sub, mul)
    op = random.choice(ops)
    
    beg1, beg2 = random.randint(1,10), random.randint(1,10)
    
    ans = op(beg1, beg2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a game where I want to determine the intersection of a
I'm creating a game in c++ and OpenGL and want an enemy to move
I m creating a game, in that i want to use some animation, but
I'm creating my own API for a game-statistics system (in PHP). And I want
I'm having trouble creating a solid game engine for my OpenGL application. It's a
I'm creating an Updater program in C# for my PC game that basically sends
I'm creating a sort of quiz game in Python and one of the questions
I am having an issue with creating a pop-up window. I have a game
Im creating a game ... I want to add a counter as a clock
I'm creating a game for my sister, and I want a function to return

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.