Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Introducing Lists Build an Application The Application

Can i switch?

def show_help(): print("Type 'HELP' if help is needed \n Type 'DONE' when you're done") show_help()

while True: name = input("Hello input please......... ") if name == "DONE": break elif name == "HELP": show_help() continue

A quick one, when I switch: show_help() continue to: continue show_help()

It doesn't work. Can I know why. cheers

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Jassim,

Please ensure that you always properly format your code, following the guidance in the Markdown Cheatsheet (linked below the answer entry box).

This is always important for code readability but absolutely critical when dealing with Python where whitespace is significant.

1 Answer

Thomas Trabue
Thomas Trabue
11,819 Points

Hello Jassim,

You are asking whether or not you can safely switch the order of the show_help() and continue statements in your program, correct? If so, let us look at what happens logically when you try to do so. When you switch the order of show_help() and continue like you just described, it causes your program to behave in a way that is not quite right. Do you see what it is? Remember, the continue statement causes the program to return to the beginning of the while loop as soon as the program encounters it. Therefore, if you place continue above your call to show_help(), then show_help() will never run because your program will return to the beginning of the loop before show_help() has a chance to execute. Does this help?