Quick script I scrambled up in
Python that asks the users how many numbers
he would like to generate in randomly
The program also restricts the user from generating more then 20 numbers.
The number must also be also exceed 0.
Code:
PHP Code:
#Import(s)
import random;
#Variable(s)
GenAmount=int(input("How many numbers should we generate (1-20) : "));
while GenAmount < 0 or GenAmount > 20:
GenAmount=int(input("Your number must be between 1-20 : "));
#Function(s)
def RandNumGen():
RandNum=random.randrange(101);
print (RandNum);
#Script
for i in range (GenAmount):
RandNumGen();
#Program termination
input("\n\nPress {ENTER} to terminate the program.");