#๐ Beginner project help
21 messages ยท Page 1 of 1 (latest)
@weary spear
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.
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
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)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
[(7, 'c'), (6, 's'), (8, 'd')]
Something like this @weary spear
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.