So I am trying to call a random name in my main method whereas it is originally this which will check those two people if they have names in common
check("Lawrence", "Shayla",newList)
My program is checking for matches in the list that I made which are all randomized, so each variable name is a random list of names and I used the String name to assign a person to each list of names.
How would I make it random where instead of hard coding a name to see if those two specific people have any names in common but now making it a random selection from the 8 names. Making it just as this below so each time I run it, it will be two random names instead?
check(c1,c2,newList)
Below is the list to show what I am doing. I'm not sure if it would be easier to make it a dictionary?
newList = [("Lawrence",Lawrence),
("Mark",Mark),
("Matt",Matt),
("John",John),
("Silvia",Silvia),
("Shayla",Shayla),
("Christina",Christina),
("Mary",Mary)]
Also is it possible to just print the strings on the list? I feel this is an easier problem using a dictionary but I wanted to try using lists instead.
Aucun commentaire:
Enregistrer un commentaire