I am new to programming and coding, and I choose Python to be my first. When I declare a variable, I notice that the variable = "x" and variable ='x' are the same. So can anyone told me the differences of "x" and 'x'
According to PEP 8(Python Coding standard)
In Python, single-quoted strings and double-quoted strings are the same. This PEP does not make a recommendation for this. Pick a rule and stick to it. When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. It improves readability. For triple-quoted strings, always use double quote characters to be consistent with the docstring convention in PEP 257.
e.g ‘single-quote’ is the same as “single-quote” You will need a double quote when you need apostrophe in the middle of the string e.g “I’m a good boy”
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With