Hey , small doubt in python we use double or single quotes in bracket when we write letters but no quotes in numbers why so? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hey , small doubt in python we use double or single quotes in bracket when we write letters but no quotes in numbers why so?

6th Jun 2022, 7:35 AM
Tanuj XD
Tanuj XD - avatar
2 Answers
+ 5
These are different data types. Strings are noted with quotes, number like floats or integers are no strings.
6th Jun 2022, 7:38 AM
Lisa
Lisa - avatar
+ 2
It's just a way for Python to distinct between strings and other stuffs. And it's not just about letters, strings can contain any characters, including digits, letters, non visible characters, and Unicode characters e.g. emojis. If something is not wrapped in quotes, they are either considered as identifier (a symbol representing data), or a literal (actual value not stored in or represented by a symbol).
6th Jun 2022, 8:19 AM
Ipang