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

  • Home
  • SEARCH
  • 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 8936203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:09:59+00:00 2026-06-15T10:09:59+00:00

I am using Python 3.2 Just so you know what I am doing, here

  • 0

I am using Python 3.2 Just so you know what I am doing, here is the assignment:
~The function random.randint from the random module can be used to produce an integer from a range of values. For example, random.randint(1,6) produces the values 1 to 6 with equal probability. A simple tutoring program may randomly select two numbers between 0 and 12 and ask a question such as the following: What is 6 times 8? Upon receiving user response, the computer checks to see if the answer is correct and gives encouraging remarks. Write a program that will loop 10 times producing questions of this form and gives a score for the user at the end.

Here is what I have in my program:

    print ("Hello. Let's begin")
    for i in range (1,10):
        from random import randint
        x=randint (0,12)
        y=randint (0,12)
        print (x,"*" y,"=?")
        product= int(input ("What is the product?")
        if (product==x*y):
           print ("Awesome! That is correct!")
        else:
           print ("Sorry, that is not correct, but let's try another one!")

I have everything working with all of this. It asks the user a random multiplication question and responds ten times. What I do not understand how to do is to give the user a score at the end. I’m brainstorming ideas and not much is really working. I think I would have to do something like:

    score=

But I don’t know how to tell the program to calculate the number of correct answers… Do I say score=number of if?

And then when I print the score I can just say:

    if (score>5) :
       print: ("Great job! You scored a",score,"out of ten!")
    else:
       print: ("Not the best score, but you can try again! You scored a",score,"out of ten.")

Or is there maybe an easier way to do this?

  • 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-06-15T10:10:00+00:00Added an answer on June 15, 2026 at 10:10 am

    First, set score to 0

    score = 0
    

    then in the loop, try something like

        if (product==x*y):
           print ("Awesome! That is correct!")
           score += 1
        else:
           print ("Sorry, that is not correct, but let's try another one!")
    

    the important part being the score += 1 this increases the score by one when you get a correct answer. You can the put your score > 5 in after the loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started learning about Gimp scripting using Python, and was wondering, how do
I just started using/learning Python and have some questions. I have a text file
I'm a Python beginner and have just started using packages. When you're calling a
I am using django 1.4 and Python 2.7. I just have a simple requirement
Using Python's csv module, is it possible to read an entire, large, csv file
Using Python, I want to know whether Java is installed.
Using Python module re, how to get the equivalent of the \w (which matches
I just started learning C++(coming from Java & Python) and am trying to learn
Im trying to fire a python function using a button created with MEL. So
I'm trying to create a GUI in Python using the Tkinter module, and part

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.