Question: Create a function called placeBet ( ) . The function will take 3 parameters, the list created in the playerSetup ( ) function, a list

Create a function called placeBet(). The function will take 3 parameters, the list created in the playerSetup() function, a list which contains the currently available bets and a string stating the bet that is being placed. The functions logic needs to do the following:
a. Read in currently available bets the file 'bets.txt' found on the D2L site. The text file contains two columns of values. Each row in file will need to be dissected and the white space removed. The items in the file are separated by tabs.
b. Iterate through the list of available bets. Compare each item in the list to the parameter you passed as a string which states which bet is being placed. The comparison is case insensitive so if I enter 'DOUble FiVe' as my bet, it will still match 'Double Five'.
c. If the bet in the list matches the bet passed as a parameter then append the bet to the player list.
d. If the bet entered by the user is not found in the list of available bets, then the playerlist is left unchanged and returned by the function
e. Like any good casino you will need to track the bets made. Write the player and bet made to a file. If you run the program multiple times then you should see every bet made throughout the multiple runs. To accomplish this use the append option for writing a file. This will create a file and append to it! For reading/writing files look at the slides starting at slide 18. This will provide all the information you need.
f. Return the playerList

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!