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 8108247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:03:08+00:00 2026-06-06T01:03:08+00:00

here is my script: from random import * from turtle import * while True:

  • 0

here is my script:

from random import *
from turtle import *

while True: 
    r1 = randint(1,20)
    r2 = randint(1,20)

    # ... ask the question ... then

    a = textinput("Answer?", "")

    if a == r1 * r2:
        write("Well done", font = ("Comic Sans MS", 30, "bold"))
    else:
        write("WRONG", font = ("Comic Sans MS", 30, "bold"))

The game is very simple. It picks too random numbers and asks you to multiply them. You get the answer right your score goes up. Get the answer wrong your score goes down. When I input the right answer it still comes up “Wrong”
I think maybe I’m doing the ifs differently or it might not be working
because of the random numbers. Has anyone got an idea what is wrong with my script. Thanks 🙂

  • 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-06T01:03:09+00:00Added an answer on June 6, 2026 at 1:03 am

    r1 * r2 is an integer.

    a is a string.

    Convert a to integer and compare.

    Converting to integer is simple:

    s = int(a)
    

    However, a ValueError can be raised and has to be handled.

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

Sidebar

Related Questions

Here's the code: from random import * numbers = ['0','1','2','3','4','5','6','7','8','9','10'] r1 = choice (numbers)
Here is a validation script from a book I am learning, Why is escaping
I am trying to call a java script function from java code. Here is
Here's an idea. I'm trying to create file from PHP script. File may be
Here is a blog post from Kirk Munro that explains how a script can
Here is my small script $item=Inception; $query=SELECT * FROM items WHERE item = '{$item}'
Here I have a simple php script which displays some values from a database
Here are the problem scripts: This is from the HTML file: <script type=text/javascript> var
I have a script for dynamic javascript date picker, taken from here . Please
Here's a fun little script I'm trying to make. Flash words from an array

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.