04: Python: Variables

Debug it:

Use and store data in variables
Python Variables: Use and store data in variables

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 writing code that uses variables.

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: If text is surrounded with quotes (e.g. "name") , it’ll use that text literally as you’ve written it.

If text is not surrounded with quotes it will use that text as a variable name and try to find the value stored in that variable.

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

5 thoughts on “04: Python: Variables

Leave a Reply

Your email address will not be published. Required fields are marked *