Hello.
Welcome back.
So in this section we going to give a quick overview of Python programming.
For those of you who are absolute beginners who have never used Python this is going to be very helpful.
After going through this section you'll be very familiar with Python and you will be able to complete
the entire course with no difficulty at all.
So I'm going to open I do by coming over here and then just type I do and open it and once it is open
I'm going to create a new file here.
I'll come in new and once the file is created I'm going to press control as to save and where I'm going
to say this I'm going to create a new forward her
operates a new Ford and I'll call this DSP cause and I'll be saving the project here.
So this is Project 0 I'll call as you underscore and then I'll call a hello like this.
And once that is done we have this it's created for us.
So let's start with printing a statement.
So print is very simple for those of you who are familiar with all the versions of python such as Python
2 the print function has changed in Python 3 in Python 3.
The print is a function therefore it requires parentheses whereas in python 2 you could just print without
adding the parentheses there.
So overhand Python 3 2 print we say print and then we open brackets like in a normal function and then
we put quotation marks to indicate it's a string and then we can put something as simple as DSP is everywhere
like this
we hit enter and we can add another statement or add another one print.
And this is going to be a long sentence sine is the always able sine wave sideways.
I'll say these are the great great grandmother of all signals.
So I say sign is the great great great grandmother of all signals like this.
So once we're done if we want to run this we just save by control s or you just click over here if you
click Run module or press F5 and you've not saved yet.
You'll be prompted to save.
So click this I can see it's printed DSP is everywhere.
Sign is great great great grandmother of all signals and that is true.
And we create variables over here you don't need to declare variables it would automatically assign
a variable.
So I can see V equals twelve W equals eleven and I can say X equals Let's see.
Zero point zero zero zero zero eight.
And it will be assigned automatically I don't need to declare it as a float or an integer although that's
a way we can type cast if we need to.
Later on you'd see how that is done.
Also one other thing about Python is it uses indentation blocks.
Right.
It uses indentation massively rather than curly braces as used in other programming languages.
So overhead indentations are actually what separate the entire code.
So let's see what I mean.
Let's say we want to use an if statement we could come down here and say if we've got two variables
fit and w we can use these we can see if V because I can see a W plus one w plus one here like this
and I put semicolon.
This is how to write a new statement.
We're comparing V here to this.
We're comparing this opera on here to this one.
We don't need to put a halt in braces.
It's completely fine this way.
If I hit enter it's automatically indented over here and I just for a comment here indented for spaces.
That's the standard indentation in Python.
You can change this if you want but it's good to keep it this way.
And after the intent indentation we can add what the the condition execute and I can see print in here
I can see.
Statement is true or true.
Any of your statements is true like this.
Any of such statements.
And then once this is done we can click here.
This time I wouldn't see.
I'll click here to run and then I'll be prompted to click on.
Okay to save and run.
Once that is done it says statement is true.
So it's automatically indent if I'm to make the mistake and just you know disable or tamper with the
indentation an error or be thrown.
So let's see this.
Yeah.
So the reason it's working is of course you know I'm tempering with the comment.
Comments don't matter.
The compiler does and or D interpreting in the case of Python doesn't care about what you do with a
comment really.
So let's say we break the indentation by just doing this to the actual instruction here and let's save
and then run.
And you can see expected an indentation block an arrow is thrown to indeed over here indentation is
everything right.
So one two three four.
See one two three four.
And I'll press control is to save and then click here to run and I can see the statement is true.
So this is the hello world of Python.
Very simple very straightforward.
This is how to print and you always remember this and that you remember indentation as well.
So this all there is for this very short lesson and I shall see you in the next lesson if you have any
questions just send me a message or leave it in the questions area.
I shall see you later.
Have a good day.