#๐Ÿ”’ Beginner project help

21 messages ยท Page 1 of 1 (latest)

weary spear
#

I'm creating a Poker game as my first project and it doesn't seem to work well

worldly rampartBOT
#

@weary spear

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

weary spear
#

I just made the shuffle and draw cards mechanic but i think i made some mistakes somewhere

#

*its a 3 card poker

#

the pdeck stores the player's 3 card number and psuit stores the player's 3 card suits

#

the output is always like this and idk where i did wrong

#

nvm i re-thought my code and realized that...

#

idk what i was thinking yesterday night

#

the code is messed up and i need someone to give me a different perspective on how to do this

fair plinth
#

There's also a method random.sample

#

But for random sample to work you'd want all the possible cards in a single list

#

!e

import random
values = range(1, 14)
suits = ["s", "d", "c", "h"]
cards = []
for suit in suits:
    for value in values:
        cards.append((value, suit))

hand = random.sample(cards, 3)
print(hand)
worldly rampartBOT
fair plinth
#

Something like this @weary spear

weary spear
#

Woah

#

this def helped

#

tysm

#

!close

worldly rampartBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.