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 trialshriram gharpure
4,032 PointsI have the exact same code as Craig in the video but my code won't run like his does [Solved]
def show_help():
print("What should we pick up at the store?")
print("""
Enter 'DONE' to stop adding items.
Enter 'HELP' for this help.
""")
show_help()
while True:
new_item = input("> ")
if new_item == 'DONE':
break
elif new_item == 'HELP':
show_help()
continue
[MOD added ```python formatting -cf]
Chris Freeman
Treehouse Moderator 68,457 PointsWhat is different than you expect?
Are you running your code using python shopping_list.py
at a linux or workspace command window prompt?
I can run your code:
$ python help_app.py
What should we pick up at the store?
Enter 'DONE' to stop adding items.
Enter 'HELP' for this help.
> blah
> blah
> HELP
What should we pick up at the store?
Enter 'DONE' to stop adding items.
Enter 'HELP' for this help.
> DONE
$
shriram gharpure
4,032 PointsI am running the code in a Treehouse Workspace with the file name shopping_list.py and I have run it with the command: python shopping_list.py
shriram gharpure
4,032 PointsOh and also, when I say HELP when the arrow is pointing it doesn't show the Enter 'DONE' print but instead continues to print more inputs
Chris Freeman
Treehouse Moderator 68,457 PointsIt is possible you're running is a different workspace, or perhaps not have saved you most recent edits?
In the upper right of the workspace is a camera icon. Select that to take a snapshot of your workspace. This creates a link you can share here for me to try your code in the exact same environment.
Chris Freeman
Treehouse Moderator 68,457 PointsGreat! I'll mark the post as [Solved]
1 Answer
shriram gharpure
4,032 PointsSORRY, I found the problem, when I was putting HELP into the input I accidentaly added a space after I said HELP. That made the code think the string was 'HELP ' instead of 'HELP'.
shriram gharpure
4,032 Pointsshriram gharpure
4,032 PointsSorry I think some of the code got cropped out of the screen where it shows the syntax