Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

dr_road12 Group Title

I'm new here, and I need to know how to generate a list of numbers from 1 to 9999 for example, when using "for x in range(1,9999)" its not working at all

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. AdisA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    I have tried: for x in range(1,9999): print x and it's working. Do you get some kind of error message?

    • 2 years ago
  2. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    the range function will generate a Python list. how are you trying to use it? http://docs.python.org/tutorial/controlflow.html#the-range-function http://docs.python.org/library/functions.html#range

    • 2 years ago
  3. carlsmith Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I'm not sure dr_road12, `for x in range(1, 9999)` should work fine, in fact, `for x in range(n)` is a very common way to knock up an iterator in Python. Are you sure you're not forgetting the colon? Every header ends in a colon... for x in range(1, 9999): print x

    • 2 years ago
  4. BD Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I agree with carlsmith, you probably forgot the colon. I've done it a hundred times and it's frustrating scouring your code to find you forgot a simple colon.

    • 2 years ago
  5. doctorwho11 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    if using python use the .randit function. same function you would use for a numbers guessing game

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.