Python Forum
For Loop and Use of Brackets to Modify Dictionary in Tic-Tac-Toe Game
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For Loop and Use of Brackets to Modify Dictionary in Tic-Tac-Toe Game
#7
Where is the "="? If there is no "=" there is no assignment. Not completely true, but mostly true.

theBoard[move] is a dictionary lookup. It will return the value associated with the key referenced by the variable "move". If move == 'top-R', theBoard[move] will return the value in the dictionary associated with the key 'top-R'. If theBoard does not contain the key 'top-R' this code raises an error.
Reply


Messages In This Thread
RE: For Loop and Use of Brackets to Modify Dictionary in Tic-Tac-Toe Game - by deanhystad - Dec-28-2021, 04:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] [BeautifulSoup] Why does it turn inserted string's brackets into </>? Winfried 0 2,805 Sep-03-2022, 11:21 PM
Last Post: Winfried
  While loop not ending (Best of 10 dice game) K3nidi 3 2,501 Jul-09-2022, 09:53 AM
Last Post: K3nidi
  Reading list items without brackets and quotes jesse68 6 7,179 Jan-14-2022, 07:07 PM
Last Post: jesse68
  Data pulled from SQL comes in brackets nickzsche 3 4,452 Jan-04-2022, 03:39 PM
Last Post: ibreeden
  loop adventure game ilikedofs 1 2,294 May-26-2021, 12:43 AM
Last Post: bowlofred
  Getting a certain value from inside brackets. LeoT 5 4,264 Mar-01-2021, 03:34 PM
Last Post: buran
  Adding to the dictionary inside the for-loop - weird behaviour InputOutput007 5 4,203 Jan-21-2021, 02:21 PM
Last Post: InputOutput007
  Iterating over a dictionary in a for loop - checking code has worked sallyjc81 1 2,652 Dec-29-2020, 05:14 PM
Last Post: ndc85430
  How to modify item in dictionary? Winfried 7 5,308 Nov-21-2020, 07:12 PM
Last Post: bowlofred
  Designing a "game" loop api pitosalas 2 3,429 Jun-07-2020, 03:20 PM
Last Post: pitosalas

Forum Jump:

User Panel Messages

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