Python Forum
How to assign a "Score" variable to each element in a list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to assign a "Score" variable to each element in a list
#5
(May-16-2019, 07:37 AM)Yoriz Wrote: If you have not been introduced to dictionary's yet you could alter your player list to have lists inside of a list.
playerList = [['player1', 5], ['player2', 8]]
Wait, I don't know if I'm misinterpreting this but just to clarify, the code first asks the main user to enter the names of the other players, which are then appended into playerList. How would I then from the different names inside the list give each name a "score" variable that all starts from 0 and eventually gain points through the total value of the rolled dices? Is player1 an index or something, this thing should be simple but I'm just getting confused
Reply


Messages In This Thread
RE: How to assign a "Score" variable to each element in a list - by Reta - May-16-2019, 12:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to update score value? Mavoz 5 2,478 Nov-08-2022, 12:37 AM
Last Post: Mavoz
  How do you find the length of an element of a list? pav1983 13 4,910 Jun-13-2020, 12:06 AM
Last Post: pav1983
  Methods that return the highest score from the list erfanakbari1 7 7,172 Mar-26-2019, 08:32 PM
Last Post: aankrose
  New to Python - tiny coding assistance on user input function and assign to variable Mountain_Duck 1 2,519 Mar-23-2019, 06:54 PM
Last Post: Yoriz
  Extracting list element with user input valve 1 2,587 Mar-11-2019, 07:37 PM
Last Post: Yoriz
  Average score MartinEvtimov 5 6,854 Apr-02-2017, 07:35 PM
Last Post: ichabod801
  maximum and minimum element from the list and return output in dict MeeranRizvi 1 3,747 Jan-02-2017, 02:12 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020