Hey Everyone,I am Vikram Salunke and welcome to Python for InfoSec.
This is part 5 and in this video we will see Strings.
So, basically strings are collections of characters.
Strings are either enclosed in with ' (single quotes) or " (double quotes).
str1 = "abc"
str2 = 'xyz'
In this example, we are defining string abc in " (double quotes) and xyz in ' (single quotes).
This will allow you to use quotes and apostrophes within strings.
str = 'He said, "Python for InfoSec is one of the best course!"'
let's print this
To use a quotes we use " (double quotes) inside a ' (single quote)
let's see example of apostrophes
str2 = "It's nice to see you."
let's print this
In this example, we are using apostrophes.
to use the apostrophes we are using ' (single quote) inside a " (double quotes).
Now let's see String Concatenation
first_name = "vikram"
last_name = "salunke"
ok, now we want to concat these two strings.
for this we will use + operator
full_name = first_name + last_name
So, we have used concatenation
Now let's put space in between for that we will use
full_name = first_name + ' ' + last_name
So, we have used + operator to combine two strings.
In programming white spaces refers to any non programming characters such as spaces, tabs and end of line symbols.
ok, let's see som examples
str = "Vikram\tSalunke"
So, \t is inserting a tab here
Now let's see example of new line
str = " x86 Assembly\nPython for InfoSec"
ok, so Python for InfoSec is on a new line because we have used \n here.
If you want to join our in person class then please click here
we are doing trainings in some upcoming InfoSec conferences.
And if you have any doubts, any questions then you can tweet me @vikramsalunke20
We are uploading daily new videos on YouTube click here to subscribe.
If you want to solve the exercises on this topic those are below. Solve the exercises and check your understandings. Thank you :)