Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Help please / need help

0 votes
asked Oct 8, 2018 by Christina1 (310 points)

Write a program that can be used as a math tutor for a young student. The program should display two random numbers that are to be added. The program should then wait for the student to enter the answer. If the answer is correct, a message of congratulations should be printed. If the answer is incorrect, a message should be printed showing the correct answer.

Note: Start with your code from the previous chapter! All you are doing for this assignment is extending your previous project by asking the user to provide the answer and telling them if they were correct or not.

The output should look something like this:
  196
+ 429
-----

Enter the answer here: 625

Congratulations!
The answer is 625

1 Answer

0 votes
answered Oct 9, 2018 by anonymous
import random

a=random.randint(0,1000)
b=random.randint(0,1000)

print(str(a)+"+"+str(b)+"=")
total=int(input())
if total==(a+b):
    print("Congratulation")
else:
    print("Sorry, You are wrong!!!")
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...