Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 DL 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 readingwriting files look at the slides starting at slide This will provide all the information you need.
f Return the playerList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started