A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 5 years ago
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
anonymous
 5 years ago
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

This Question is Closed

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0what 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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0That'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')]

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Nessman thanks I am gonna look on test.py now

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Can 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)

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0lol @ Nessman yes it did work thanks and I will be your fan after you answer more thing for me

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0if its within my power

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0ok 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])

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0what 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?

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0yeah friday thanx in advance

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0You 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.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0for sure gonna hit vegas big time just like 21 lol, here's two for u onyx

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0a 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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0it should output >>>split([1,2,3,4,5,6,7]) ([1,2,3], [4,5,6,7])

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0here'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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0which outputs >>>interleave ([1,2,3], [4,5,6,7]) [1,4,2,5,3,6,7]

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Ok I can do those really quick just one question what is this for?

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I am tryna implement a gofish game using python

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0here'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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I'm fine if you want to do the dealing part onyx, I'll keep working on it regardless as its a fun exercise.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0ok Onyx have a great night

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0O 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.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0let me see how it works 1st but i get what u saying

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0ok cool i'll do he other one tomorrow

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Okay 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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0ok this is the second part of that function deal(), after this there is one function called gofish() which is a void

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0here'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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Whenever you have time u can look at my cesar cipher it's not 100% but it's good

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Okay 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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0hit 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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0and 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)

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0ok 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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Hey 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.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0wow it posted on wrong page that was wierd.
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.