as it seems to repeat this trend with every single run I have performed (about 30) and is obviously not useful if I need random variables throughout greater ranges.Below is an example of the code and below the example is a test run of the program.
Expand|Select|Wrap|Line Numbers
- x = 1
- list1 = []
- list_Choices = []
- list_Choices = input ('Please enter your choices.')
- while len(list1) < 90
- if ('1') in list_choices:
- x = random.randint (1,100)
- elif ('12') in list_choices:
- x = random.randint (1,200)
- elif ('23') in list_choices:
- x = random.randint (101,300)
- elif ('123') in list_choices:
- x = random.randint (1,300)
- while x in list1:
- x += 1
- input("Press Enter to continue...")
- while x not in list1:
- list1.append(x)
- print(list1)
- if len(list1) == 90:
- input('Please press any key.')
Examples:
Test Run Example 1
-----------------------------------------------------------------------------------
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Please enter you choices.123
[60, 15, 20, 61, 55, 52, 79, 24, 64, 56, 26, 62, 90, 63, 54, 70, 45, 29, 86,
81, 59, 2, 96, 3, 100, 23, 78, 58, 48, 66, 71, 67, 5, 87, 46, 57, 97, 13, 27,
65, 6, 51, 7, 11, 22, 8, 34, 21, 72, 80, 47, 82, 18, 91, 92, 98, 74, 68, 69,
73, 88, 75, 76, 25, 16, 49, 33, 28, 77, 95, 99, 83, 38, 53, 4, 84, 85, 17, 89,
93, 94, 101, 102, 43, 35, 9, 103, 12, 36, 44]
Press Enter to continue...
Test Run Example 2
-----------------------------------------------------------------------------------
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Please enter you choices.123
[60, 5, 24, 61, 87, 48, 62, 71, 95, 96, 88, 63, 15, 9, 37, 14, 86, 89, 8, 100,
74, 97, 54, 16, 99, 84, 13, 27, 10, 73, 98, 28, 32, 33, 75, 34, 25, 2, 43, 85,
22, 7, 47, 57, 26, 6, 80, 93, 94, 76, 17, 11, 79, 12, 50, 39, 53, 4, 29, 46, 19,
18, 21, 30, 41, 20, 40, 23, 31, 78, 101, 77, 81, 35, 64, 52, 90, 82, 42, 102, 36,
92, 103, 104, 44, 45, 83, 38, 49, 51]
Press Enter to continue...