What is the difference between using print and solely inputting in string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between using print and solely inputting in string?

the difference between using 'print' and string

15th Jul 2018, 10:26 AM
Abdul Mubdi Bindar
5 Answers
+ 1
Ok, so I assume Python. In shell this might work. But if you type the string in playground or any .py file and compile it, you won't get any output for just using a string. There you definitely need print() to get output into the console.
15th Jul 2018, 10:38 AM
Matthias
Matthias - avatar
+ 4
Print is a method used to output content to the console/user interface. Strings are variables used to store a series of characters, which can later be manipulated using text/string processing algorithms.
15th Jul 2018, 10:38 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
thank you, Matthias, I am sorry for not putting the context before. It is python. Right, i was confused because the question in the string module put the triple quotes right away and there was an output. So i thought displaying any text in python could be done just by using the quotes mark. Also, i don't quite understand what the "newline" module is trying to told me about.. edit: now i understand the purpose of the triple quote: it helps you not to bother yourself typing backslash n to make a new line. but, it only works by using "print" stuff. Thank you everybody.
15th Jul 2018, 10:45 AM
Abdul Mubdi Bindar
0
Which language? Could you give an example?
15th Jul 2018, 10:33 AM
Matthias
Matthias - avatar
0
>>>"Hello World" >>>print('Hello World')
15th Jul 2018, 10:34 AM
Abdul Mubdi Bindar