Hi there, face here, just thought i would point out that the introduction page to lesson five of python; "Conditionals & Control Flow" has what i would consider some sloppy coding.
In the example code, the function clinic() repeats the lines
"You've just entered the clinic!"
"Do you take the door on the left or the right?"
every time you input an answer other than right or left,
Now i dont know about you, but in every video game ive ever played, every text based adventure ive ever gone through, if you input a non answer like that, rather than repeat the entire introduction to the question, youd instead just repeat the question.
Now im not perfect by any means, but i propose a better solution, rather than repeating the introductory two lines before asking for input, split the function into two functions, one that says the introduction, and one that handles the input selection.
def clinic(): print "You've just entered the clinic!" print "Do you take the door on the left or the right?" def clinic_choice(): answer = raw_input("Type left or right and hit 'Enter'.").lower() if answer == "left" or answer == "l": print "You picked left!" elif answer == "right" or answer == "r": print "You picked right!" else: print "You didn't pick left or right! Try again." clinic_choice() clinic() clinic_choice()
having coded in lua for a few years before deciding i need to learn python, and so far being annoyed by the complete inability for python to concatenate strings and variables (at least so far) like lua does, (which is admittedly irrelevant to the task at hand) i would approach a situation like this by breaking the code into two functions, maybe adding a wait between the two, using slowprint to add flair, doing things like that.
I dont know how experienced you have to be to make a course, and you know, maybe it doesnt matter in the end if you repeat the introductory lines every time, but i thought someone somewhere might find it interesting to see a different approach to it.
I dont mean to imply any inferiority, but i am confused why given free reign of design why you wouldnt just split those into two clauses.
sincerely yours, this guy.