in this tutorial we'll learn how to get the last two characters in python

syntax

1
string[-3:]

example 1

1
2
3
4
5
6
7
#string
string = "hello world"

#get last two characters string
fil = string[-3:]

print(fil)

output

rld

example 2

1
2
3
4
5
6
#example 2
string = "my name is mark"

fil = string[-3:]

print(fil)

output

ark

English today is not an art to be mastered it's just a tool to use to get a result