How do you know if you're supposed to use ' " or nothing to surround text in Python?
6/24/2018 1:01:16 PM
Alisse Canre3 Answers
New AnswerYou need ' or " to make a string. What you use is a matter of style or convention both will work, just use them consistenly. ("this' is no good) I think mostly " are used for strings that represent sentences in human language like "hello world" and ' are used for more abstract strings like single charaters etc.
Text (strings) are always inside " or '. But make sure to use the same one as the start and end! "String"
You can use single or double inverted comma's to create string .but if you want to do tricks with your String then you can try both. e.g= x=('"Hi"') print(x) output="Hi" because "" is also a string here.
Learn Playing. Play Learning
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message