video

Lesson video

In progress...

Loading...

Hi, I'm Rebecca, your computing teacher for the Programming Part 3 unit.

Now, for this lesson, you're going to need a Replit account which you should have already set up with your parent or carer's permission.

You're also going to need a pen and paper so that you can take notes and answer the questions that I give you in the lesson.

It's a really good idea as well to remove as many distractions as you can so that you can really focus in this lesson.

Once you've got all of that ready, we can begin.

In this lesson, you will describe the purpose of pseudoccode, you'll translate pseudocode into a programme, and you'll design and build a programme using pseudocode.

Think about this then.

Take a look at that code on the left-hand side and think well, why would this code not run in Python? So pause the video while you have a bit of a think about that.

Let's take a look then.

So if you look at those highlighted sections on that code, you can see that this isn't Python syntax that's being used, so this will not be executed if you try to run it in Python.

This is actually something called pseudocode.

Pseudocode is informal steps for an algorithm using structured English.

There is no specific syntax for pseudocode and it should be human readable so that a programmer can translate it into programme code.

Pseudocode is used to design programmes just like we can do with flow charts, and we looked at flow charts in Programming Part 1.

It is intended for humans to read and not for a computer to interpret.

So you can see another example there of pseudocode on the right-hand side, with a flow chart next to it.

You might see pseudocode used in a textbook or an exam paper to represent an algorithm or programme.

You might also use pseudocode to sketch out the structure of a programme before writing it in a chosen language.

What I'd like you to do then is take a look at the pseudocode that I've given you on the worksheet, and I want you to have a go at translating it into Python programme code.

Once you've had a go, you can then test it by running it in Replit.

So enter that code into Replit and see if it actually works.

So that's a good way to test if you have translated it correctly.

So pause the video while you have a go at that.

Excellent, let's look at the solution then.

So this is what you should have come up with in your Python code.

So if you didn't quite get there, you can make corrections now, or you can just give yourself a big tick if you got it right.

Pause the video while you check.

So are there set rules for pseudocode? And what I want you to do is really remember this.

Pseudocode is informal steps for an algorithm using structured English.

There is no specific syntax for pseudocode and it should be human readable so that a programmer can translate it into programme code.

It's really, really important to remember that.

Some organisations have pseudocode standardisation document that programmers stick to.

This makes it easier for other programmers to translate their designs into code.

And here is one that you can use for your own design.

So if you look at that short link on there, you'll be able to see some sample pseudocode structure for you to use.

But as I've said, you do not need to use this, because pseudocode doesn't follow a specific syntax.

If it did, it would pretty much be a programming language, if it could be compiled.

So everyone has their own unique style.

The important thing is that it is informal steps for an algorithm using structured English.

So it shouldn't be too sort of waffly, if you get what I mean by that.

It should be variables.

If this is true, do this.

You know, real structured English there.

You're going to have a go now at solving a problem.

Now this is going to be probably one of the biggest problems that you've had so far in Part 1, 2 and 3 of Programming.

And that's because not only is it quite challenging, but also I'm not giving you a lot of help and support with actually having a go at doing this challenge.

I want you to try and really think hard yourself and try and be a bit more independent if you can.

Now, my biggest clue with this programme is to look back at things that you've done before.

And that's why it's really important to save the code as you go along.

So you can go into your Replit account and look at code that you've done in the past, particularly one that you did in the trace tables lesson.

So if you go back to that lesson and look at the code that you did in there, you're going to need to use mod, which was that percentage symbol, because you need to work out if a value has got a remainder, because you're going to be looking to find out if it's divisible by three or five, and if a value isn't divisible by a certain number it's going to leave a remainder, isn't it? So you're going to have to do something with that in your code.

So that's my little clue to help you along the way.

But I want you to do is try and read this really carefully.

Now, this project is meant to take you quite some thinking time.

So it might take you longer than sort of 45, 50 minutes to actually do this.

So don't panic and think, "Oh, I'm taking too long." This could take some learners around two hours to complete.

It could be anything really, from 40 minutes to two hours to actually do.

So be prepared to just sit a little while and really think, and when you're planning this through, I want you to plan it using pseudocode.

So again, you can use your own structure for that if you want to, or you can use that document that I gave you a short link to to give you an idea of the structure.

Some people like to have that handy because they're not quite sure what to write.

And so sometimes it's handy to have that there if you need it.

So, good luck.

Have a really good go at it and then I shall go through the solutions in a few moments.

Pause the video while you have a go at that.

Let's take a look at the solution then.

So this is my possible solution.

So remember, with everything that I give you, all these solutions, as long as it's working it really doesn't matter how you've done it.

There are slightly better ways to do things in programming but you're still learning and it's always debatable, as well.

Programmers argue all the time about what's the most efficient way to do things.

So this is my way of solving that problem.

This is how I did it.

This is the pseudocode that I wrote for the Fizzbuzz programme.

So you can look at that now and check that with your programme.

Hopefully, you realised that you needed to use that percentage symbol to work out if there was a remainder.

If you didn't quite get there and you need a bit of support now, you can take a look at my pseudocode that I've done.

And you could actually probably, before I show you the next bit, if you want to just take my pseudocode and try and translate it into Python code, that would be a good thing to do if you did need that extra little bit of support.

So don't watch the next little bit where I give you the answer.

If you are really struggling with that, take my pseudocode that I've given you there, pause now, and see if you can translate it into Python code, because I think that will help you a lot.

But if you were fine, if you're happy to just check it and move on and look at how it would be in Python, then keep watching now.

So here is what it would look like in Python.

So quite a similar structure, really, but this time, instead of using the capital while, and the end while, and the thens and all of those things, we've now just got the actual Python syntax there.

So this is the programme and how it would actually work in Python if we wanted to run it as a programme as well.

So if you want to, again, pause the video now and just check that with your own work, then you can do that too, now.

Excellent, so you've had a go then at doing some pseudocode and this is something that you will use here and there as we get further and further through these units.

So the programming unit is one massive unit, but it's been broken down into parts.

So you're currently on Part 3, you should have had a go at Part 1 and Part 2 before doing this unit.

And next you've got Part 4 as well to have it go at.

And the more you work through these units the more pseudocode you'll be using.

You might choose to use flow charts and you will be starting to design things more and work a bit more independently as well.

So we try to sort of take a little bit of the support away to try and get you to be a bit more independent, so we're not helping you too much in these lessons.

But if you still need it, we are still going to provide those solutions as well for you, if you still need that extra help.

So don't panic.

So if you'd like to, please ask your parent or carer to share your work on Instagram, Facebook, or Twitter.

Tag in @OakNational and #LearnwithOak.

And your next unit in this series is unit Programming Part 4, so enjoy that one.