+ 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”?

10th Jul 2019, 8:05 AM
Sean Wu
Sean Wu - avatar
10 Answers
+ 3
Yes
10th Jul 2019, 8:12 AM
Airree
Airree - avatar
+ 2
You kind of have to, because just putting random strings doesn't do anything
10th Jul 2019, 8:08 AM
Airree
Airree - avatar
+ 2
An explanation of the command prompt, what you enter and the output you get from the Python interpreter.
11th Jul 2019, 4:14 AM
Sonic
Sonic - avatar
+ 2
You need to direct the print output to the console so you need the print command đŸ€”
12th Jul 2019, 3:25 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 1
thanks Airree. So that part of the sample is not sample of codes but just an explanation i guess?...
10th Jul 2019, 8:12 AM
Sean Wu
Sean Wu - avatar
+ 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.
11th Jul 2019, 9:33 PM
Loeschzwerg
+ 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
22nd Jul 2019, 12:37 AM
kamali sridhar
kamali sridhar - avatar
0
No it not required
22nd Jul 2019, 12:33 AM
kamali sridhar
kamali sridhar - avatar
- 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
22nd Jul 2019, 4:58 PM
Khushal
Khushal - avatar