Nov-12-2022, 03:47 AM
(This post was last modified: Nov-12-2022, 03:47 AM by deanhystad.)
How did you determine that given the user enters 0.3 that the only viable options are 1) Team A wins & Team D wins or 2) Team B wins & Team D wins?
That is the first step. Defining the steps needed to come up with a solution. Write them down on paper and apply them to different inputs. If the steps always give the correct answer, they define the algorithm. This algorithm is the central part of your program.
The algorithm should help you decide how you decide what data structures will work best for your solution. When solving using pencil and paper, how did you organize the data? Did you make a table like this?
That is the first step. Defining the steps needed to come up with a solution. Write them down on paper and apply them to different inputs. If the steps always give the correct answer, they define the algorithm. This algorithm is the central part of your program.
The algorithm should help you decide how you decide what data structures will work best for your solution. When solving using pencil and paper, how did you organize the data? Did you make a table like this?
Output:Game, win, draw, lose
A-B, 0.3, 0.5, 0.2
C-D, 0.5, 0.4, 0.1
This could be implemented many ways in Python. It could be a pandas dataframe. It could be a row of dictionaries. It could be a row of rows.