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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:53:29+00:00 2026-06-17T05:53:29+00:00

Here is my code: import random min_num = 1 max_num = input(Pick your maximum

  • 0

Here is my code:

import random

min_num = 1
max_num = input("Pick your maximum number: ")
used_num = []

def rndnum(used_num):
    a = random.randint(min_num,max_num)
    b = random.randint(min_num,max_num)
    num_string = str(a) + "," + str(b)
    if num_string not in used_num:
        return a,b,num_string
    else:
        rndnum(used_num)

def to_continue(used_num):
    d = raw_input("Press [Enter] to Continue")
    ask(used_num)

def finished():
    print "Congratulations, you are finished!"

def ask(used_num): 
    a,b,num_string = rndnum(used_num)
    c = input(str(len(used_num)+1) + ". What is " + str(a) + " times " + str(b) + "? ")
    if c == a*b:
        used_num.append(num_string)
        print "That is correct! Only " + str(max_num**2 - len(used_num)) + " remaining!"
        if len(used_num) == max_num**2:
            finished()
        else:
        to_continue(used_num)
    else:
        print "That is incorrect."
        to_continue(used_num)

ask(used_num)

And this is the error being shown:

Traceback (most recent call last):
   File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 37, in <module>
    ask(used_num)
   File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 32, in ask
   to_continue(used_num)
  File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 18, in to_continue
    ask(used_num)
  File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 32, in ask
    to_continue(used_num)
   File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 18, in to_continue
    ask(used_num)
  File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 32, in ask
     to_continue(used_num)
  File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 18, in to_continue
    ask(used_num)
   File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 32, in ask
    to_continue(used_num)
  File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 18, in to_continue
     ask(used_num)
   File "/home/philip/Documents/Aptana Studio 3 Workspace/Eli Tests/helloworld.py", line 24, in ask
    a,b,num_string = rndnum(used_num)
 TypeError: 'NoneType' object is not iterable

What is going wrong? 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-17T05:53:30+00:00Added an answer on June 17, 2026 at 5:53 am

    You forgot a return on the last line of your rndnum function. Instead of returning the values it implicitly returns None. Fixed code below.

    def rndnum(used_num):
        a = random.randint(min_num,max_num)
        b = random.randint(min_num,max_num)
        num_string = str(a) + "," + str(b)
        if num_string not in used_num:
            return a,b,num_string
        else:
            return rndnum(used_num)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my code: #This is a game to guess a random number. import random
This is my current code: import random while True: try: num = int(input(Enter the
Here's the code: from random import * numbers = ['0','1','2','3','4','5','6','7','8','9','10'] r1 = choice (numbers)
Here is the code: import javax.swing.SwingUtilities; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JLabel; import java.awt.event.*;
Here is my code: import javax.swing.*; import java.awt.*; public class PanelModel { public static
Here is my code import org.ksoap2.*; import org.ksoap2.serialization.*; import org.ksoap2.transport.*; import android.app.Activity; import android.os.Bundle;
Here is the code: import javax.swing.*; import java.awt.event.*; import java.awt.*; public class TestGrid {
For some reason, I can't get pyglet to draw sprites. Here's my code: import
Here is some sample Python code: import re some_regex = re.compile(r\s+1\s+) result = some_regex.search(
Here I found this code: import java.awt.*; import javax.swing.*; public class FunWithPanels extends JFrame

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.