lundi 6 avril 2020

python random number list generator

im a novice at python much of it is still very confusing i am taking a college course and the material just isnt cutting it for me. i need to make a list of random numbers than separate each number odd over even here is my current progress

import random
def main():
          for x in range(20):
         number=list(random.randint(1,101))
        for number in number:
                   list=number

for x in list:
if (number % 2) == 0:
      print("{0} is Even number".format(num))
else:
    print("{0} is Odd number".format(num))



Aucun commentaire:

Enregistrer un commentaire