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
#6
I think what Yoriz was suggesting is a list of sub-lists, where each sub-list is the name of the player and their score. So say you have a currentPlayer variable, which is the index of Yoriz's playerList for the current player. So at the beginning of the game, currentPlayer is 0 (for the first player). The name of the player is playerList[currentPlayer][0] ('player1') and the player's score is playerList[currentPlayer][1] (5).
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to update score value? Mavoz 5 2,477 Nov-08-2022, 12:37 AM
Last Post: Mavoz
  How do you find the length of an element of a list? pav1983 13 4,907 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,516 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,852 Apr-02-2017, 07:35 PM
Last Post: ichabod801
  maximum and minimum element from the list and return output in dict MeeranRizvi 1 3,746 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