program modification

User Generated

Anvsss

Programming

Description

I need you to modify the file called ( the program file ), so that when you (input the file), you get the (output file). there is instruction file

Unformatted Attachment Preview

10/2/2017 CSCI 127, Program 2 Program 2: Three Card Poker Logistics Due Date: Tuesday, October 3rd no later than midnight. Partner Information: You may complete this assignment individually or with exactly one partner. If you work with a partner, you must both be enrolled in the same lab section or you will both lose 10 points. Submission Instructions: Upload your solution, renamed to YourFirstName-YourLastNamePartnerFirstName-PartnerLastName.py to the BrightSpace Program 2 Dropbox. If you work with a partner, only one person should submit the solution. However, to avoid losing 10 points, write both names in the BrightSpace Dropbox comment box. Deadline Reminder: Once the submission deadline passes, BrightSpace will no longer accept your Python submission and you will no longer be able to earn credit. Thus, if you are not able to fully complete the assignment, submit whatever you have before the deadline so that partial credit can be earned. Learning Outcomes To solve this problem, you need to understand the following new Python concepts: lists, files. Background Information A three-card poker hand consists of any three cards from a standard 52-card deck. For a single card, there are 13 possible ranks (two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace) and 4 possible suits (clubs, diamonds, hearts, spades). A Flush occurs when all cards have the same suit. Three of a Kind occurs when all cards have the same rank. Two of a Kind occurs when two of the three cards have the same rank. If none of the above three situations applies, the hand is worth Nothing. Assignment Download poker.py and modify it so that when it is run on this input file, it produces this output file. Assumptions The input file contains an unknown number of poker hands. Each line contains a three card poker hand in this format: Card 1 Rank, Card 1 Suit, Card 2 Rank, Card 2 Suit, Card 3 Rank, Card 3 Suit. All poker hands are valid and use only lowercase letters. Grading - 100 points 10 points - Every Flush is identified correctly. 10 points - Every Three of a Kind is identified correctly. 10 points - Every Two of a Kind is identified correctly. 10 points - Every Nothing is identified correctly. 10 points - At least three of the following boolean functions exist and are used correctly in the solution: flush, three_of_a_kind, two_of_a_kind and nothing. https://www.cs.montana.edu/paxton/classes/csci127/programs/program2/ 1/2 10/2/2017 CSCI 127, Program 2 15 points - The format of the output file matches the format of the sample output file above exactly. (3 points for each type of difference up to 15 points.) 15 points - The Python solution is properly commented, easy to understand and does not contain unnecessary code. (3 points for each type of improvement up to 15 points.) 20 points - All output appears in the correct output file (15 points) and no output appears in the Python shell (5 points). Honor's Lab The points you earn from the grading scale above will be multiplied by .9 for a maximum of 90 points. The other 10 points can be earned by enhancing the assignment in a creative, non-trivial manner. In the BrightSpace Dropbox comment box, describe your enhancement clearly. (You must include this comment to earn the additional points.) https://www.cs.montana.edu/paxton/classes/csci127/programs/program2/ 2/2 10/2/2017 https://www.cs.montana.edu/paxton/classes/csci127/programs/program2/poker.in ace hearts king hearts queen hearts three diamonds three spades three clubs two hearts two diamonds four hearts five hearts six diamonds five clubs seven hearts eight diamonds eight hearts ten hearts nine diamonds jack hearts https://www.cs.montana.edu/paxton/classes/csci127/programs/program2/poker.in 1/1 10/2/2017 https://www.cs.montana.edu/paxton/classes/csci127/programs/program2/poker.out Poker Hand ---------Card 1: Ace of Hearts Card 2: King of Hearts Card 3: Queen of Hearts Poker Hand Evaluation: FLUSH Poker Hand ---------Card 1: Three of Diamonds Card 2: Three of Spades Card 3: Three of Clubs Poker Hand Evaluation: THREE OF A KIND Poker Hand ---------Card 1: Two of Hearts Card 2: Two of Diamonds Card 3: Four of Hearts Poker Hand Evaluation: TWO OF A KIND Poker Hand ---------Card 1: Five of Hearts Card 2: Six of Diamonds Card 3: Five of Hearts Poker Hand Evaluation: TWO OF A KIND Poker Hand ---------Card 1: Seven of Hearts Card 2: Eight of Diamonds Card 3: Eight of Hearts Poker Hand Evaluation: TWO OF A KIND Poker Hand ---------Card 1: Ten of Hearts Card 2: Nine of Diamonds Card 3: Jack of Hearts Poker Hand Evaluation: NOTHING https://www.cs.montana.edu/paxton/classes/csci127/programs/program2/poker.out 1/1 10/2/2017 https://www.cs.montana.edu/paxton/classes/csci127/programs/program2/poker.py # -------------------------------------# Do not change anything below this line # -------------------------------------def main(poker_input, poker_output, cards_in_hand): for hand in poker_input: hand = hand.split() hand_as_list = [] for i in range(cards_in_hand): hand_as_list.append([hand[0], hand[1]]) hand = hand[2:] print_hand(hand_as_list, poker_output) evaluate(hand_as_list, poker_output) # -------------------------------------poker_input = open("poker.in", "r") poker_output = open("poker.out", "w") main(poker_input, poker_output, 3) poker_input.close() poker_output.close() https://www.cs.montana.edu/paxton/classes/csci127/programs/program2/poker.py 1/1
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hi,Sorry for the delay, but when ypu ac...


Anonymous
Excellent resource! Really helped me get the gist of things.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags