dimanche 24 février 2019

Decision Making from User Input + store results in a list [Open Question]

I'm relatively new to programing and so what I'm asking is more for advice/guidance on how to proceed with a particular problem, instead of requesting for specific code advice.

I'm trying to create a piece of software which when ran from the console it asks the user if they will choose "a", "b" or "c". When a choice has been made it will then save that result to an empty list (was gonna use .append) and depending on the previous choice made, will branch/present the user with a selection of new options to choose from. When they have reached the end of the decision making process, it would then print the list so that the user could see their choices.

I've been thinking of it like a decision tree and made this rather bad diagram for me to help conceptualize it's structure and rules (as in which options/choices flow into what).

enter image description here

If you follow the link you can see the diagram. Basically I was thinking on creating a very long and ugly if-elif-else chain, with some nested if statements, that would use conditional logic that will present the user with certain options, dependent on what they have previously chosen. For instance, to get to "c3" all you need to do is choose C at the start and then follow the chain of c1 -> c2 -> c3. Which is a very linear progression. but if you wanted to get to "ab2" the user has two ways to get there either by: A -> a2 -> ab1 -> ab2 or B -> b1 -> ab1 -> ab2; which has a bit more of a dynamic progression.

How would you construct this? Is there any particular things/concepts I should be thinking about like creating this in a function that's a While loop or possibly using a dictionary instead of an empty List?

I understand if this type of question is not standard on here and therefore gets down voted. But it's a programing project based off an idea I have, and any form of information to get me thinking in the right track would be appreciated.

Aucun commentaire:

Enregistrer un commentaire