November 7th, 2012, 08:01 PM
*Random Number File Writer* help
Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 100. The application should let the user specify how many random numbers the file will hold. This is what i have so far.
# This program displays five random
# numbers in the range of 1 through 100.
for count in range():
# Get a random number.
number = random.randint(1, 100)
# Display the number.
# Call the main function.
How do i change this so the user can specify how many numbers will show?
November 7th, 2012, 09:39 PM
# source for prompt is in post 4 of http://forums.devshed.com/python-programming-11/newbie-question-regarding-exceptions-933626.html
rv = int(s)
if rv < 0: raise ValueError()
for count in range(prompt('How many random numbers? ',conversion=positive_integer,default=1)):
[/code] are essential for python code and Makefiles!