I'm making a piece of code that asks users to input their name and three scores into a program. This will continue happening within a while loop until it is stopped (meaning there could be 2 users entering scores or 50 depending on how many are entered). I want to append the user's name and the three scores for each into a list (each user being a unique list) but I don't know how to automatically create different list names. For example, something like user1, user2, user3 etc. would do, as long as there was the same number of lists as users that entered their name and scores. I hope this makes sense.
-
1This is a common question and the answer is: use a dictionary instead of plain variables.Paulo Scardine– Paulo Scardine2015-10-28 11:56:59 +00:00Commented Oct 28, 2015 at 11:56
-
Could you link me to the original question please?Daisy Bradbury– Daisy Bradbury2015-10-28 12:00:41 +00:00Commented Oct 28, 2015 at 12:00
-
There are many questions like this: stackoverflow.com/questions/5036700/…Paulo Scardine– Paulo Scardine2015-10-28 12:02:23 +00:00Commented Oct 28, 2015 at 12:02
-
stackoverflow.com/questions/17685199/…Paulo Scardine– Paulo Scardine2015-10-28 12:02:58 +00:00Commented Oct 28, 2015 at 12:02
-
1Also see the blogpost titled Why you don't want to dynamically create variables.martineau– martineau2015-10-28 12:33:06 +00:00Commented Oct 28, 2015 at 12:33
Add a comment
|