05: Python: Naming Conventions

Debug it:

Use variables and constants with sensible names
Python naming conventions: Use variables and constants with sensible names

Debugging means finding and fixing errors (bugs) in your code.

Below is some code that has been deliberately broken so that you can find and fix some common mistakes when choosing suitable names for variables and constants.

Hints: Check the brackets, spelling and quotation marks.

Your code won’t run at all until you’ve fixed all of the errors: You need to fix all the lines of code even before the first line will run.

Remember: Use variables_like_this to store data that might change whilst your program runs (for example, if the user types them in)

Use CONSTANTS_LIKE_THIS to store data that you might use lots, but only ever set once, often at the start of the program.

On the next page you’ll get some ideas for how to write your own projects thatĀ ask the user to input something.

Leave a Reply