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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:22:51+00:00 2026-06-05T07:22:51+00:00

I have recently decided to learn basic programming, and am using an MIT OpenCourseware

  • 0

I have recently decided to learn basic programming, and am using an MIT OpenCourseware class to learn in Python. One of the assignments is to create a program that generates the 1000th prime number starting from 0. One of my first solutions is as follows:

oddList = []
for odd in range(3, 10000):
if odd % 2 != 0:
    oddList.append(odd)
else:
    continue


primeCount = 3
loopHolder = True
while loopHolder == True:

for possiblePrime in oddList:
    if primeCount == 1000:
        print possiblePrime
        loopHolder = False
    from math import *
    limit = int(math.sqrt(possiblePrime)

    for primeTest in range(2, limit):
            testCount = 0
            if possiblePrime % primeTest == 0:
                testCount = testCount + 1
                primeCount = primeCount                
            else:
                continue
            if testCount > 0:
                primeCount = primeCount
                break
            else:
                primeCount = primeCount + 1
                break

However, when I run it, I get a syntax error at
“for primeTest in range(2, limit):” and python is highlighting the colon specifically. I realize the error is probably a result of a syntax error somewhere else, but I can’t find it. Could someone point out where my error is?

PS: Help with the semantics of the code is not needed, though appreciated.

  • 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-05T07:22:52+00:00Added an answer on June 5, 2026 at 7:22 am

    You have “while loopHolder == True:” without an indented block after it. You should probably write this as “while loopHolder:”, as the == True part isn’t required. I would also avoid doing the import within the loop. Import statements are usually at the top of the file, unless you need it to be somewhere else. You also don’t have a closing bracket after “limit = int(math.sqrt(possiblePrime)”.

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

Sidebar

Related Questions

Recently I decided to expand my programming horizons and learn the python programming language.
I have just recently started out programming for Android, and have decided that I
One of my non-programmer friends recently decided to make a C++ program to solve
I have recently decided to deploy my site test onto my home server using
I've recently decided that I just have to finally learn C/C++, and there is
I have designed a store using PayPal Express Checkout. They have recently decided that
I have recently inherited a large project using an sqlite3 database and currently I
I have recently upgraded to the RC versions of the WebApi using Nuget but
I have recently released an app on Google play see here When using Google
I recently started C++. I am using PHP right now and decided to take

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.