Python Strings For Beginners
- Get link
- X
- Other Apps
This tutorial is fully made for intermediate and absolute beginners.
you can learn from the very beginning so let's take a look. there is some statement like print, input or many so can learn it by doing code yourself, if there is something important so I can highlight it, so don't need to worry about it.
String :
"String is type of alphabetic code like english letters"
In python you can define string as ::
a=3
b="String"
print(a,b)
print("my name is",(a))
print("This is ",str(b))
The string is a very easy topic and you can learn it is very fast and also python is very simple so don't panic that how can I learn this.
String Slicing:
Slicing is a way to find a substring from the main string with some specific location.
before slicing you must know about the indexes because in any language we'll count from 0.
so like in the name "NITIN" there is 5 number then indexing is ::
N I T I N
0 1 2 3 4
now syntax is : : print(string_name[starting_index: ending_index])
first_String= "NITIN"
print(first_String[0:2])
OUTPUT : NI
It'll print n-1 number, n= end_index.
print(name[-4:-1]) # It's same as name[1:4]
OUTPUT : ITI
It'll start printing from at index 1.
for more detail :
String Function :
- Get link
- X
- Other Apps
Comments