Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time to get started on Python homework...
#15
I hate to double post, but I didn't want to start a new thread.

Here is the second part of this assignment:

Code:
Your previous lottery number generator would work for selecting Lotto 6/49 numbers but other lotteries use different sets of numbers and different lengths of lists. It would be much more useful if we could have a program that would let the user input the minimum and maximum values for the random generated numbers as well as the number of random numbers needed, like this:

>>> How many random numbers do you need generated?
5
>>> What is the minimum value of random number?
1
>>> What is the maximum value of random number?
20

>>> [2,17,4,12,9]

Write a program called lotto2.py that will get input from the user for the number of random numbers to be generated, the minimum value and the maximum value. It should include a function called "numlist" that will take those three values as parameters then return (*not print*) the list of random values.

Now my brainstorming got me to the point of using inputs in place of the min and max(1, 50) and the number of numbers(:6), I tired using variables for them, but I guess I'm too much of a noob to do any of this.. Also, I have no idea of where to use this "numlist" he speaks of.
Reply


Messages In This Thread
Time to get started on Python homework... - by Alley - 2011-10-22, 07:46 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)