lundi 6 avril 2020

How do you randomly generate and add numbers for lists, later comparing all the numbers?

How do you randomly generate and add numbers for the first three lists? I need to ask the user how many numbers they want in the lists (suggesting that they enter at least 1-15 numbers for each list).

I also have to devise a way to compare all of the numbers in the three lists, so any tips on how to go about doing that? Should a number be present in all three lists - I have to add it to the matching_numbers list. If a number doesn’t match any of the other numbers, then I have to add it to the unique_numbers list.

list_1 = []

list_2 = []

list_3 = []

matching_numbers = []

unique_numbers = []

import random

randnum = random.randint(1, 100)

name = input("Hello USER. What will your name be?")

print("Hello " + name + ". Welcome to the NUMBERS program.")

listone = float(input("How many numbers do you wish to have for your first list? Please choose from between 1 and 15."))



Aucun commentaire:

Enregistrer un commentaire