Can a space be given in variable naming. I tried a python program but it's showing an error I have attached the screenshot of the same.
Asked
Active
Viewed 91 times
-3
-
1Have you not answered your own question? You can see the definition of identifiers here: https://docs.python.org/3/reference/lexical_analysis.html#identifiers – jonrsharpe Jun 21 '20 at 07:08
-
No, it can't. Use underscore `_` – Thierry Lathuille Jun 21 '20 at 07:08
-
No you can't, the common convention is to use `snake_case` for variables and function names and to use `PascalCase` for class names. – Amal K Jun 21 '20 at 07:13
1 Answers
-1
You can't give a space. It's violating the naming convention. What you can do, add underscore (_) between words. Here is the correction:
Gal_Gadot = "Gal Gadot"
print(Gal_Gadot);
Hope this makes sense.

Rashed Rahat
- 2,357
- 2
- 18
- 38
-
1"Violating the convention" would be e.g. `Names_Like_This`. Spaces in identifiers are invalid syntax. – jonrsharpe Jun 21 '20 at 07:11
-
1What i mean is that against the naming convention. Simply means that it can't! – Rashed Rahat Jun 21 '20 at 07:12
-
1The naming conventions are https://www.python.org/dev/peps/pep-0008/#naming-conventions. They are all *within* what is syntactically valid. – jonrsharpe Jun 21 '20 at 07:12
-
2
-