@
@charan123
asked

Expert
Kelish Rai answered
Hi Charan,
You can use both in Python, but a single string must start and end with the same type of quote.
These are fine:
text1 = "Hello"
text2 = 'Hello'
You can mix them inside the string to avoid escaping:
msg1 = "It's a sunny day"
msg2 = 'She said, "Keep learning."'
But this is not valid because the quotes do not match:
text = "Hello'
If you have more questions, I am here to help π
Python
This question was asked as part of the Learn Python Basics course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer
