Hi,
I'm helping out some teenagers (14yo ish) who have just started programming and 
are working on a 'call tree' program as part of some after school coding 
classes and I wanted to talk about potential solutions. 

The first task is to implement a 'troubleshooting program' similar to what a 
phone operator would have when you phone up with a problem. We all know the 
type when you phone up your ISP, 'have you turned it off and on again?', "have 
you changed your telephone filter' etc..

It states there should be at least 10 questions and that the user should reach 
a solution, e.g. 'replace your power cable'. There and my initial reaction was 
that this could be achieved by lots of if/else statements with each question 
running onto another one, ugly but it would certainly work. One of them pointed 
out how inefficient this was and asked if there was another way, they hated 
writing out tons of if/elif/else statements.

Does anyone have any ideas for a more elegant solution? My thoughts are that I 
could use a tree data structure and hence make traversing the tree recursive 
based on yes or no answers. I'm happy to put the time in to explain these more 
complex ideas, I'm just hoping those with more expertise than myself could 
either help verify the idea or suggest alternatives.

Thanks in advance!
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to