The way we write a line of code is important, as the computer needs to recognise it.
Think about our 'English'. It is important that we use correct punctuation, such as Commas and Full Stops. If we didn't, it would make our writing difficult to read.
If we do not use the correct symbols and spellings in our Python coding, then the computer will not be-able to run our programs.
Slide 11 - Tekstslide
What is debugging?
Debugging code refers to the process of identifying and fixing errors, bugs, or defects in a computer program that we have created.
An error occurs, when you have done something wrong in your program. You could have spelt something wrong or even missed out a symbol...
Slide 12 - Tekstslide
Debugging Continued...
Create with code, shows you where your error is. Below is a screenshot that shows this.
Slide 13 - Tekstslide
Task 2 - Debugging
In this task, you will need to debug the code using the error messages that create with code provide.
In programming, a variable is like a container that holds a piece of information. This information can be anything, like a number, a word, or even a whole sentence!
For example, imagine you have a box that can hold a piece of fruit. You can put an apple in the box, and then later on, you can take the apple out and look at it or even swap it for a banana. In programming, a variable is like that box. You can put information into the variable, and then you can use that information later on in your program and change it as you please.
To use a variable, you first need to give it a name. This is like labelling the box with the word "fruitbox" so you know what's inside. In programming, you can choose any name you want for your variable, as long as it follows certain rules. For example, the name can't have spaces in it, and it can't start with a number.