0

How dose string work?

for print, we use: print('word') to get the output : word But I didn't understand how a string is used. Like I typed: 'I am leader' and the output was : No output lol. First off all is this lesson trying to say " 'word' " is a string? or it can be used like print!? Help is appreciated :D

10th Feb 2020, 7:13 PM
sanees
sanees - avatar
2 odpowiedzi
+ 6
You should use print( ) to output a string to console. For example: print("I am leader") If you will type only "I am leader" then there will be no output. If you are using python shell (Interactive mode) then writing "I am leader" will output this string but in script mode you will need print(). In this they are using interactive mode: https://www.sololearn.com/learn/Python/2274/?ref=app
10th Feb 2020, 7:40 PM
VEDANG
VEDANG - avatar
+ 3
Yes, 'word' is a string and print() is a function that outputs this string to console
10th Feb 2020, 7:25 PM
Lisa
Lisa - avatar