Ask coding questions

← Back to all posts
What is the use of >>> in python?
MuffinsTheCat (18)

Often when I look at python tutorials I see something like this:

>>>print("Hello, world!")

But when I type code with the >>> is returns an invalid syntax error. When I remove it the code works perfectly fine. So what is the use of >>> in python?

Answered by SixBeeps (5062) [earned 5 cycles]
View Answer
SixBeeps (5062)

>>> is a cue to type something in IDLE, meaning you should put it in the console rather than in code. If you want to put it in code, remove the >>> altogether.