>> in Python


I have been reading Python textbooks and all of the code for some reason at the beginning of each line starts with >>. What is it and what does it do?


Probably a prompt, asking the user for input.
Python has a REPL (read eval print loop) that lets you run commands interactively, its default prompt is >>>

On my machine, here's what running python 2 looks like:

$ python2
Python 2.7.11 (default, Mar 31 2016, 06:18:34) 
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'hello world'
hello world

As you can see, at the first line there's a different prompt, that's bash asking for input