Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help! Lists
#3
When you built the deck you did this:
deck += [card]  # [card] is a list
When you dealt the cards you did this:
h += deck[f] # deck[f] is a string
To prevent appending a bunch of strings together you can do like you did when making the cards or you can use list.append()
h += [deck[f]]
or
h.append(deck[f])
I think you should build the your deck and hands using "append()", it is more familiar to programmers.
Reply


Messages In This Thread
Help! Lists - by bwdu - Apr-03-2020, 11:44 AM
RE: Help! Lists - by Mateusz - Apr-03-2020, 12:28 PM
RE: Help! Lists - by deanhystad - Apr-03-2020, 12:54 PM
RE: Help! Lists - by bwdu - Apr-03-2020, 03:07 PM
RE: Help! Lists - by deanhystad - Apr-03-2020, 06:28 PM
RE: Help! Lists - by bwdu - Apr-04-2020, 10:12 AM
RE: Help! Lists - by deanhystad - Apr-04-2020, 01:08 PM
RE: Help! Lists - by perfringo - Apr-05-2020, 06:39 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  sort lists of lists with multiple criteria: similar values need to be treated equal stillsen 2 3,354 Mar-20-2019, 08:01 PM
Last Post: stillsen

Forum Jump:

User Panel Messages

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