Formatting Variables: What's the Standard?

While working on this exercise, I noticed that the examples for declaring variables with more than word use an underscore to separate_words. I’ve taken a couple classes on Java which uses camelCase. Will the python_grammar_police come after me if I useCamelCase?

From my experience with Python no. You would do this because you can use underscores you would use them because it is easier to separate the words in a variable. You can use camelCase thought but using underscores is preferred.

1 Like

On a slightly lighter note, I’d recommend listening to the PEP8 song (PEP8 is Python’s formatting guide).

2 Likes