If i can put >>> before write print, then error msg shows that is invalid text, why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

If i can put >>> before write print, then error msg shows that is invalid text, why?

I wrote >>> print ("Hi, I am Ana Maheshwari")

16th Jun 2018, 1:17 PM
Ana Maheshwari
Ana Maheshwari - avatar
5 Answers
+ 2
You can execute python in 2 ways: Shell mode, and interpreted mode... With shell mode, python run and wait for you direct input and use '>>>' symbol to notify you that you can insert input... Interpreted mode its execute without your input (but you have to tell to python which script you want execute)... How different are they for run? Shell mode happen when you call python without provide it a script to execute, else you run python in interpreter mode... Turn at you problem, how you run python? You write that text in a .py script and pass it to python?
16th Jun 2018, 1:36 PM
KrOW
KrOW - avatar
+ 2
Because often examples go with practical writing and for very simple codes, shell mode its more immediate. In interpreted you have to create a .py file, write you script on it, save and run python with script path like argument but in shell mode you have to run python and write you statements
16th Jun 2018, 1:58 PM
KrOW
KrOW - avatar
+ 1
You are using an IDE, not a terminal, and even if you were using a terminal, most IDEs nowadays have terminals that don't actually require those ">>>"
16th Jun 2018, 6:46 PM
Dlite
Dlite - avatar
0
Okay if it is not necessary for using. Actually i m just beginner & still i m not clear with your responses cause in starting examples i saw that >>> used in all questions so i used.
16th Jun 2018, 1:45 PM
Ana Maheshwari
Ana Maheshwari - avatar
0
that only works when using interactive mode(the IDE provides it), but in your own programs using a text editor u will omit >>>, if not u will get an error
16th Jun 2018, 10:43 PM
ghali lawal
ghali lawal - avatar