+ 8
Is âprintâ required to show text strings?
In a sample it said: >>>âspamâ + âeggâ âSpam eggâ When I try it myself, there is no output? I thought you can get the text shown without typing in âprintâ?
9 Answers
+ 3
Yes
+ 2
You kind of have to, because just putting random strings doesn't do anything
+ 2
An explanation of the command prompt, what you enter and the output you get from the Python interpreter.
+ 2
You need to direct the print output to the console so you need the print command đ€
+ 1
thanks Airree. So that part of the sample is not sample of codes but just an explanation i guess?...
+ 1
Your prompt (aka Interpreter) is not the same as a python program.
Stuff you put in a file is evaluated at runtime, while the interpreter prints the returning value, you don't have to type the print.
If you put a string in a file, the file doesn't return anything, you have to print it.
+ 1
In python print used print because when goes string length it does come for example input if typing "I am learning python " to give print it come output:I am learning python
0
No it not required
- 1
Print is required only in script mode as it requires. Py. extension as script mode require more information than interactively mode so print is not required to show a text