What does ">>>" do in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What does ">>>" do in Python?

The fuction of ">>>" in Python

8th Jan 2017, 8:47 AM
Matin
Matin - avatar
10 Answers
+ 13
'>>>' does nothing in Python, meaning that's not an operator. Usualy, you're encountered it as the 'prompt' sign of Python Idle ( command line interpretor ). He's often reproduce in example on internet, and always start an instruction/line ;) Complementary, '...' is the 'prompt' sign too in Idle, for new start line when the command/instruction needs multi lines ( and often indentation ).
8th Jan 2017, 8:58 AM
visph
visph - avatar
+ 6
Not at all... In Python single line comments ( as '//' in C++ ) should start with '#', and multi-lines comments ( as '/* comment */ in C++ ) should be delimited by triple double quote ( """ comment """ ). This delimiters are also using for documentation/inline-help... The '>>>' is rarely encoutered in a script, and if it does, it would be fortuitous... because it's be displayed as COMMAND LINE PROMPT, for the Python interpretor: a console/terminal like for directly executing Python instructions/code ^^ What isn't clear?
8th Jan 2017, 2:07 PM
visph
visph - avatar
+ 6
No, I couldn't: run a console/terminal whatever OS you have and type "python" ( if you have Python installed, in case of ms windows ) at the command prompt, obviously execute, and you will understand :|
8th Jan 2017, 3:31 PM
visph
visph - avatar
+ 6
This is my last answer: If in the beginning of a line we have ">>>" it means that the example incite you to execute the nexted code directly at command line, but you can also write it in a file and say to python to run the file... Command line is a commodity to quickly and interactivly test an expression, or few lines of code. You never must type the triple '>', since it has a custom signification/reason... }P
8th Jan 2017, 3:41 PM
visph
visph - avatar
+ 6
Python console: >>>12+3 15 >>>a=5 >>>a 5 >>>for i in range(5): print(i+1) 1 2 3 4 5 >>>
17th Aug 2017, 2:32 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
So it has the main function" */../* "in C++.yeah?? I mean it is a comment.
8th Jan 2017, 1:56 PM
Matin
Matin - avatar
+ 2
Could you give me an example?
8th Jan 2017, 3:26 PM
Matin
Matin - avatar
+ 2
Thanks a lot
8th Jan 2017, 3:43 PM
Matin
Matin - avatar
+ 2
45>>2>2 true
17th Aug 2017, 2:19 AM
Paulax
Paulax - avatar
+ 1
So if in the beginning of a line we have ">>>" it means one the line we should write command prompt form.yes?
8th Jan 2017, 3:35 PM
Matin
Matin - avatar