how can I create a deck of 52 cards when a single card is represented by a tuple ('H','A') with suits=['H','C','S','D'] and facevalue=['2','3','4','5','6','7','8','9','10','J','Q','K','A']? I tried to zip suits and facevalue but it didn't work

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

how can I create a deck of 52 cards when a single card is represented by a tuple ('H','A') with suits=['H','C','S','D'] and facevalue=['2','3','4','5','6','7','8','9','10','J','Q','K','A']? I tried to zip suits and facevalue but it didn't work

MIT 6.00 Intro Computer Science (OCW)
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

what output do you want? I am only on lecture 5 so i can really only give you a list of tuples, that is easy enough. if you want individually named variables with a tuple each, your out of luck on this end the attached file contains a very simple program to create this list, bound to a variable z hope this helps you
1 Attachment
That's the output I want >>> makedeck() [('H', '2'), ('H', '3'), ('H', '4'), ('H', '5'), ('H', '6'), ('H', '7'), ('H', '8'), ('H', '9'), ('H', '10'), ('H', 'J'), ('H', 'Q'), ('H', 'K'), ('H', 'A'), ('C', '2'), ('C', '3'), ('C', '4'), ('C', '5'), ('C', '6'), ('C', '7'), ('C', '8'), ('C', '9'), ('C', '10'), ('C', 'J'), ('C', 'Q'), ('C', 'K'), ('C', 'A'), ('S', '2'), ('S', '3'), ('S', '4'), ('S', '5'), ('S', '6'), ('S', '7'), ('S', '8'), ('S', '9'), ('S', '10'), ('S', 'J'), ('S', 'Q'), ('S', 'K'), ('S', 'A'), ('D', '2'), ('D', '3'), ('D', '4'), ('D', '5'), ('D', '6'), ('D', '7'), ('D', '8'), ('D', '9'), ('D', '10'), ('D', 'J'), ('D', 'Q'), ('D', 'K'), ('D', 'A')]
Nessman thanks I am gonna look on test.py now

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Can I get confirmation if what i produced was what you were looking for? I'd appreciate having my first fan (as shameless as it sounds)
lol @ Nessman yes it did work thanks and I will be your fan after you answer more thing for me
if its within my power
ok Nessman how would u write a function function deal() which takes three arguments, a deck of cards, number of cards to deal and number of players and returns a tuple where the first part of the tuple is a list and the second part of the tuple is the list of cards which have not been dealt. The first part of the tuple gives a list of lists, where each list represents the hand of each player. Therefore it shows the cards that have been dealt to each player, for example if 4 cards were dealt to two players the lists looks like this example shown below, where the red list is hands of the first player and the blue list is the hands of the second player. ([ [('H', '2'), ('C', '6'), ('H', '10'), ('D', 'A')], [('D', '4'), ('H', '8'), ('H', 'Q'), ('C', '3')] ], [remaining deck])
what fun, I'll get to work on it, but I'm not sure what I can do but I'll keep you posted, got a deadline?
yeah friday thanx in advance
You planning on going to vegas? haha and Nessman do you want to do it or does it matter because i think I can do this but I don't wanna swoop on your thing.
for sure gonna hit vegas big time just like 21 lol, here's two for u onyx
a function split that takes a list as an input and splits it into two. The first list is the first half of the given integer list and the second is second half of the integer list (if the list length is odd then the second half of the pair should be longer
it should output >>>split([1,2,3,4,5,6,7]) ([1,2,3], [4,5,6,7])
here's the next one:a recursive function interleave, which takes a pair of two integer lists as input and returns a list which contains all the items of the input lists, but in alternating order
which outputs >>>interleave ([1,2,3], [4,5,6,7]) [1,4,2,5,3,6,7]
Ok I can do those really quick just one question what is this for?
I am tryna implement a gofish game using python
O ok
here's your first one it splits it in half I have to go to bed otherwise i'd do other one I might do it in morning. lis=list(raw_input('Please enter a list:')) x=len(lis)/2 lis1=lis[:x] lis2=lis[x:] print lis1,lis2
I'm fine if you want to do the dealing part onyx, I'll keep working on it regardless as its a fun exercise.
ok Onyx have a great night
O my fault I didn't think about the fact that your implementing this into a bigger program do you want me to rewrite it as a function.
let me see how it works 1st but i get what u saying
it worked well
ok cool i'll do he other one tomorrow
Okay I got something to generate the hands, I need to create a function that then puts them in a pile and shows the remaining cards
ok this is the second part of that function deal(), after this there is one function called gofish() which is a void
here's the second part askForcard() which takes a card and a hand and return a tuple where first part of the tuple is a Boolean value if the cardvalue is found in the hand. For example, if we are asking our opponent for a ā€˜Jā€™ and the opponents hand is [('H', 'A'), ('D', 'J')] we are retuned tuple where first part is a boolean value indicating if the card is present and second part returns the position of the card in the opponents hand, if the card is not there just return 0 for position
Whenever you have time u can look at my cesar cipher it's not 100% but it's good
Okay I got lost, but its late so maybe the last two posts will make sense in the morning, I haven't tested anything past a few test cases but i did finish a deal out function like you requested
hit the post before i hit the attach button, deal pumps out what you want, hand gives you an single hand, and i included the deck program as a function all my pieces are functions, i can comment it if you want, but you'll have to wait until morning i feel like my sentences make less sense as the night progresses
1 Attachment
and i just realized that wasn't the latest version and still has a few test lines, sorry about that, just change the print statements at the end to how ever you want your output its also a list not a tuple, which can easily be fixed if you change the square brackets to parens [ ]->() on the [hands, remaining] so something that looks like return (hands, remaining)
ok thanx again I will run the codes in tha morning my eyes are as heavy as lead right now have a great one 2marrow night same time, remember to look at tha cipher
Hey reckk does it really have to be recursive because if not I think I'd be done by now. haha I never completely understood recursive functions so it takes me a while to write them.
wow it posted on wrong page that was wierd.

Not the answer you are looking for?

Search for more explanations.

Ask your own question