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 Python Basics (2015) Shopping List App Shopping List Introduction

Paul Resendez
Paul Resendez
2,990 Points

Shopping List Introduction

At 4:30ish in the Shopping List Introduction video I am unclear as to what Kenneth is doing. He talks about using a simple prompt and uses a single '> ' symbol. Could someone help me out by elaborating on this? What exactly is he doing? Please help!

r h
r h
68,552 Points

What you are doing is actually creating a prompt yourself. Back in the day, when you coded in BASIC, whenever a prompt was needed from the user a ">" appeared on screen to the left of the cursor, which indicated that an input was required. This is a reference to BASIC stylization, because he wants us to input("> ") with the text that appears on screen just the "> " prompt. It's not even code, it's just a string. In other words, it could be input("Insert something to buy: ") and the cursor would wait to the right of the colon (:). > is just an abbreviation for input visually on the screen, not a python command or anything.

Paul Resendez
Paul Resendez
2,990 Points

Great! I understand. Thanks!

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,457 Points

The prompt can be any text string. The use of "*> *" is an arbitrary example. Whatever string is used as the argument to the input() function will be displayed to the user. Sometimes a specific question can be used as a prompt:

input("What do you need? ")

Yields

What do you need?

The cursor is left at the end of the prompt. A space is often left at the end if the prompt string to leave a visual gap between the prompt and the users input.

More info in Python docs input()

Paul Resendez
Paul Resendez
2,990 Points

Great! I understand. Thanks!