Python Forum
card dealer school project
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
card dealer school project
#5
(Jan-05-2019, 07:15 PM)ichabod801 Wrote: You're not changing suit or rank for one thing, so yeah, they are always going to be the same. And you are creating them at random, rather than as a deck, so you could end up giving five twos of clubs to the same player.

Create a list of all the cards in the deck (looping through all of the ranks, then looping through all of the cards). Use random.shuffle to mix up the list. Deal the cards from the deck using pop or slicing.

ive done this and it still does not work. didnt understand what u mean

import itertools, random

# make a deck of cards
deck = list(itertools.product(range(1,14),['Spade','Heart','Diamond','Club']))

# shuffle the cards
random.shuffle(deck)
i=int(input('how many are going to play?'))

def poker(i):

    print("player", i,'gets')
    for i in range(5):
        print(deck[i][0], "of", deck[i][1])
        i-=1
        print(poker(i))

print(poker(i))
Reply


Messages In This Thread
card dealer school project - by kalle1234 - Jan-05-2019, 05:52 PM
RE: card dealer school project - by Larz60+ - Jan-05-2019, 05:55 PM
RE: card dealer school project - by kalle1234 - Jan-05-2019, 06:38 PM
RE: card dealer school project - by ichabod801 - Jan-05-2019, 07:15 PM
RE: card dealer school project - by kalle1234 - Jan-05-2019, 07:40 PM
RE: card dealer school project - by ichabod801 - Jan-05-2019, 09:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  my python project for school vavervirus 2 761 Oct-12-2023, 03:28 AM
Last Post: buran
Shocked School project -- need help with it it says syntax error XPGKNIGHT 6 3,451 Aug-11-2022, 08:43 PM
Last Post: deanhystad
  School project janivar91 3 2,830 Jan-23-2021, 06:31 AM
Last Post: KonohaHokage
  Python School Project andreas30298 2 2,224 Nov-12-2020, 09:58 AM
Last Post: Axel_Erfurt
  I need help for a school project IndyNeerhoff 1 2,157 Sep-28-2019, 08:28 PM
Last Post: Gribouillis
  Turtle Graphics Card Values in a List Muzz 0 2,401 Apr-11-2019, 12:55 PM
Last Post: Muzz
  [Tkinter] Tkinter project school Kersow 2 2,542 Apr-08-2019, 08:45 PM
Last Post: Larz60+
  Playing Card Sorting ness828 4 94,873 Feb-05-2018, 09:01 PM
Last Post: sparkz_alot
  Small game (school project) Ganesh 7 5,767 Nov-08-2017, 09:04 PM
Last Post: Ganesh
  card 21 trick SummoningZ 21 16,215 Aug-24-2017, 12:42 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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