Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

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

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

I have tried: for x in range(1,9999): print x and it's working. Do you get some kind of error message?
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
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

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

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.
if using python use the .randit function. same function you would use for a numbers guessing game

Not the answer you are looking for?

Search for more explanations.

Ask your own question