Question

Write a program which gives an easy mathematics quiz. The program should display two random numbers...

Write a program which gives an easy mathematics quiz. The program should display two random numbers which are to be added together, like this: 117 + 213 ----- The program should ask the user to enter their answer. If the answer is correct, the user should be congratulated. If the answer is wrong, the right answer should be displayed and the user should be scolded. Don't forget to: Generate random numbers Ask the user if they want to be tested again. If they don't want another math problem, the program should end. If they do want to try again, the new problem should display.

USE PYTHON

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import random
again = 'y'
while again=='y':
    x = random.randint(1,500)
    y = random.randint(1,500)
    print(str(x)+" + "+str(y)+" ? ")
    answer = int(input())
    if(answer==x+y):
        print("Yes correct, you are great!")
    else:
        print("Incorrect, Learn how to do additions")
    again = input("You want to tray again? (y/n) ")

Output:

421 + 14 ? 2134 Incorrect, Learn how to do additions You want to tray again? (y/n) y 125 + 488 ? 613 Yes correct, you are gre

Note: Please comment below if you have any doubts. upuote the solution if it helped. Thanks!

Add a comment
Know the answer?
Add Answer to:
Write a program which gives an easy mathematics quiz. The program should display two random numbers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • USING A PYTHON Write a program that gives simple math quizzes. The program should display two...

    USING A PYTHON Write a program that gives simple math quizzes. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.

  • In phyton 11. Math Quiz Write a program that gives simple math quizzes. The program should...

    In phyton 11. Math Quiz Write a program that gives simple math quizzes. The program should display two random numbers that are to be added, such as: 247 +129 The program should allow the student to enter the answer. If the answer is correct, a mes- sage of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed

  • Need a program in java that creates a random addition math quiz The program should ask...

    Need a program in java that creates a random addition math quiz The program should ask the user to enter the following The smallest and largest positive numbers to be used when generating the questions - The total number of questions to be generated per quiz - The total number of the quiz's to create from then the program should generate a random math (Just addition) quiz from what the user entered

  • mathTutor Write a program that selects two random numbers -20 to 20. The two numbers would...

    mathTutor Write a program that selects two random numbers -20 to 20. The two numbers would get displayed with "+" between them. The user should enter the sum of the two numbers. The program should print "Incorrect" if the user enters a wrong answer and re-prompts the user to re-enter the answer again. Limit the number of incorrect tries to 3. After 3 incorrect tries print the correct answer. The program should print a message like "Correct!" if the user...

  • mathTutor Write a program that selects two random numbers -20 to 20. The two numbers would...

    mathTutor Write a program that selects two random numbers -20 to 20. The two numbers would get displayed with "+" between them. The user should enter the sum of the two numbers. The program should print "Incorrect" if the user enters a wrong answer and re-prompts the user to re-enter the answer again. Limit the number of incorrect tries to 3. After 3 incorrect tries print the correct answer. The program should print a message like "Correct!" if the user...

  • Need a program in java that creates a random addition math quiz The program should ask...

    Need a program in java that creates a random addition math quiz The program should ask the user to enter the following The smallest and largest positive numbers to be used when generating the questions - The total number of questions to be generated per quiz - The total number of the quiz's to create

  • USING C LANGUAGE _Design_ a program that asks the user to answer (easy) multiplication problems. It...

    USING C LANGUAGE _Design_ a program that asks the user to answer (easy) multiplication problems. It is up to you how many math problems you want it to present. The numbers should be chosen at random. The program will then display the user stats: - number of problems answered correctly out of the total - percent correct - grade letter (>= 90 is A, >= 80 is B, >= 70 is C, >=60 is D, < 60 is F)   Example...

  • Write a python program that generates a list of 50 random numbers. The program should display...

    Write a python program that generates a list of 50 random numbers. The program should display (with labels) the sum, average, largest, and smallest of the list along with the list before and after sorting. Bonus: Find the mode (if any)

  • Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random...

    Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random method to produce two positive one-digit integers. The program should then prompt the user with a question using random numbers, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display the message "Very good!" and ask whether the student wants to continue if so then ask another multiplication...

  • Write a MIPS math quiz program in MARS. The program should start with a friendly user...

    Write a MIPS math quiz program in MARS. The program should start with a friendly user greeting. From there, it should generate a random arithmetic problem. Your program will need to generate three random things: the first and second operand and the operator to use. Your program should generate random positive integers no greater than 20 for the operands. The possible operators are +, -, * and / (division). The user should be prompted for an answer to the problem....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT