Question

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 In phyton
0 0
Add a comment Improve this question Transcribed image text
Answer #1

._d add quiz.py-D:/Coding/PYTHON/add quiz.ру (3.6.2) File Edit Format Run Options Window Help import random #Generate 2 rando

OUTPUT :

RESTART D: /Coding/PYTHON/ add quiz.ру ーーーーーーーーーーーーーーーーー : +、329 332 Sorry! Correct ans is 338 RESTART: D:/Coding/PYTHON/add

CODE :

import random
#Generate 2 random numbers
a = random.randint(1,1000)
b = random.randint(1,1000)

print(' '+str(a)+'\n+`'+str(b))
#Take user prompt
ans = int(input())
if a+b==ans:
print('Congratulations! Ans is correct')
else:
print('Sorry! Correct ans is '+str(a+b))

Add a comment
Know the answer?
Add Answer to:
In phyton 11. Math Quiz Write a program that gives simple math quizzes. The program should...
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.

  • Write a program that can be used as a math instructor for a young student. The...

    Write a program that can be used as a math instructor for a young student. The program should display two random numbers to be added, such as: 247 + 129 The program should then pause while the student works on the problem. When the student is ready to check the answer, he or she can press a key and the program will display the correct solution: 247 +129 346

  • 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...

  • 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....

  • 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

  • Math Problem Generator Your job will be to write a C++ program to teach math to...

    Math Problem Generator Your job will be to write a C++ program to teach math to school children. Your program will accomplish this by showing sets of math problems to the user and allowing them to enter an answer. The program should tell the user if they are correct and should continue providing additional questions. The program will keep track of correct and incorrect answers. The questions should use random numbers and should be simple enough math problems that someone...

  • 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

  • (For Python program)   Write a program that fulfills the functionalities of a mathematical quiz with the...

    (For Python program)   Write a program that fulfills the functionalities of a mathematical quiz with the four basic arithmetic operations, i.e., addition, subtraction, multiplication and integer division. A sample partial output of the math quiz program is shown below. The user can select the type of math operations that he/she would like to proceed with. Once a choice (i.e., menu option index) is entered, the program generates a question and asks the user for an answer. A sample partial output...

  • 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...

  • Create a website that displays an adding quiz (use random numbers between 0 and 100 -...

    Create a website that displays an adding quiz (use random numbers between 0 and 100 - see the image below). The elapsed time will also displayed. When an answer is submitted, your JS program should check whether the given answer is correct or incorrect, and then a suitable pop-up message- whether the answer is wrong or right- should be displayed. The timer should wait until the user click the okay button. If the answer is correct a new quiz should...

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