Professional Documents
Culture Documents
In [3]:
# String Reverse
name = "python"
print (name[::-1])
nohtyp
In [33]:
# String Medhods
name= "This is String Method"
Lengta of string is 21
String in lower charactor is : this is string method
THIS IS STRING METHOD
This Is String Method
The char i in the string is 3 times
In [27]:
# String Indexing
name= "python"
print(f"The first char is {name[0]}") #print first char
print(f"The Fourth char is {name[3]}") #print 4th char
print(f"The first four char is {name[0:4]}") # print from 0 index to 3rd index
print(f"at interval of 2 is {name[0:6:2]}") # print from 0 to 5th index with step of tw
o
In [28]:
# Reverse of a string
name = "python"
print(name[-1::-1])
nohtyp
localhost:8888/nbconvert/html/Untitled3.ipynb?download=false 1/2
2/29/2020 Untitled3
In [31]:
In [36]:
Hellow_how_are_you_dear_are_you_feeling_well
Position of are1 is : 11
Position of are2 is : 24
In [38]:
# If Else Statement
#syntex - if {this}:
age= int(input("Enter your age")) #user input in intiger
if age>=18: # if statement
print('You are a adult') #if statement true the this code will exicute
else:
print('You are under 18') #if statement is false this code will exicute
In [ ]:
localhost:8888/nbconvert/html/Untitled3.ipynb?download=false 2/2