About strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About strings

Is there any difference when I use 'or " while writing a string

20th Jun 2018, 5:06 AM
Himanshu Gupta
Himanshu Gupta - avatar
1 Answer
+ 4
Himanshu Gupta ,hi Yes and No! 🔽Because : The difference between print and a string is this: For print: input; print('Python is fun!') output; Python is fun For string: input; 'Python is fun' output; 'Python is fun' The difference between double and single quotation marks is that using single quotation marks and an apostrophe in the text creates an error as it thinks the text ends at the apostrophe. Double quotations marks prevent this, or you can use a backward slash before the apostrophe like this: input; 'He\'s a coder' and input; "He's a coder" both have the same output: output; "He's a coder" Note: answer by Maen Halabi. ⏺️For read about string, see below lesson in Sololearn: https://www.sololearn.com/learn/Python/2274/ ❤️If this answer is useful for you, upvote it and mark as answer(Tap on ✅ button). 😉
20th Jun 2018, 5:18 AM
Root
Root - avatar