Python Python Basics (2015) Shopping List App Shopping List Introduction

Lisa Miller
Lisa Miller
680 Points

Why was a greater than sign used here? new_item = input ("> ")

This is in shopping list app. Could you leave it blank as well? Thank you!!

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 144,378 Points

Hi Lisa,

Here it's actually not being used as a "greater than" symbol, but rather just a symbol to denote a prompt. It makes a bit more sense in context and if you are using it at the end of a sentence. Here would be two examples, first without and second with it.

Enter an item please

Enter an item please >

You could do it to you own aesthetic pleasings...

Enter an item please ==>

So, yes it could be left off, but it is good to have something like that when building console-based programs. On a website, you style an input box so the input needed is obvious. But in the console, having a > or : or ==> just adds that bit of clarity that the program is expecting the user to now input something.

Hope that makes sense. :) :dizzy:

Lisa Miller
Lisa Miller
680 Points

Makes sense! Thank you Jason!!