Question: PYTHON: We now have to calculate the total value of the cards we have. To do this write a function called calculateTotal() which takes the
PYTHON: We now have to calculate the total value of the cards we have. To do this write a function called calculateTotal() which takes the a list representing the players cardsas its only parameter. Ideally this list was returned from #3. If #3 is incomplete then create a list to be used for testing purposes. The function should do the following Traditionally an Ace can be used for 11 or 1. For our purposes you can set an Ace to be either 11 or 1. There is noneed to create a user choice on the matter i. Keep in mind when iterating through the players hand. Any face cards (Jack, Queen King, Ace) will fail when you try to use eval() on them. You will need to be able to handle this so the function does NOTcrash. ii. Iterate through the cards the player holds and calculate their value. a. Return the calculated total
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
