Today is our first lesson in Python programming, Python is very easy and strong programming language
that most hackers and penetration testers using nowadays to create testing tools and exploits.
Let's begin with a simple hello world.
In order for us to print the strength of the screen, we use the word print followed by space in the
string we want to print and double quotes or single quotes in Python three, it's print followed by
printing these, then the string you want to print and double quotes or single quotes.
Let's try that.
We can also add or concatenate strings together by using the plus sign.
Let's see example.
But in this example, we need to head a space either after the word hello or before the word world,
or maybe we can separate a space as a string between them.
Let's try again.
Nice.
Now let's see how we print an integer when printing an integer, we don't surround it in double quotes
or single quotes.
Can we print a number as a string?
Yeah, sure.
But by doing that, we can't use this number as an integer anymore because we have change its type.
Let's verify that by using the word type.
Let's create a variable called X and assign the number 10 to it as a strength.
Then we add another number to it.
Let's see what happens.
See, it doesn't like adding string to integer, but how can we solve this?
Well, we can change the type of X to integer and reassign it, or we can do it on the fly by adding
the typecasting and in front of it.
Let's try.
Let's see how we subtract, divide and multiply in Python, which is very easy to do.
We divide by using the force flash, we multiply by using the the asterisk and subtract by using the
minus sine or dash.
If we create a variable X with the value of ten
and we want to add another number to it, we can do that by either using the traditional way X equals
X plus 10
or X plus equal 10.
Same thing.
If you want to subtract it will be X minus equal 10.
Now, if we want to assign hex value to a variable, we can do that in two ways.
First is to use the zero X to indicate we are using hex value.
Let's try that
or we can use the base 16.
We can do the same thing with binary, but we need to have zero B in front of our binary number, let's
print the number four in binary.
The number four in binary is zero zero zero zero zero one zero zero or just hundred.
Let's try that.
Let's see the second way of using binary.
Now, if we want to print a value is binary harrex, we can use the word bin for binary and hextor hexadecimal.
Let's print the number two hundred and fifty five in binary and X.
Nice.
Let's go back to String's again.
There are three ways to assign string in Python.
First, using double quotes.
Second, using single quote,
third is using triple quotes,
the triple quotes is very useful if you want to have multiple one string.
Let's take a look.
Now, what if you want to print a double quotes in our string?
Let's try by using double quotes first.
Oops, it didn't work in order to solve this, we have to escape our double quotes and treat it as a
literal string.
We can do that by adding backslash in front of each one.
Another way is to surround the whole string in single quotes.
We have reached the end of this lesson.
Thank you and see you in the next one.