Python chapter 3

String Functions



# b = '''onam"s and onam's'''
# print (b)
# concatenating two strings
# greeting = "good morning, "
# name = "Onam"
# c = greeting + name 
# print(c)
# sring index
name = "Onam"
# print (name[4])
# print (name[0:4])
# print (name[:4])  # is same as name[0:4]
# print (name[-4:-2]) # is same as name[2:4]

# skip string 
name = "Awesome"
d = name[0:5:2]  
print (d)



String function


'''
story = "once upon a time there was a youtuber who upload python course with notes"
# # String function
# print (len(story))
# print (story.endswith("notes"))
# print (story.count("a"))
# print (story.capitalize())
print (story.find("who"))
print (story.replace("youtuber", "onam"))
'''
story = "onam is good. \nhe\t is\' go\\od"  # \n= new line \t=tab \'=sigle quotes
print (story)

Comments

Popular posts from this blog

Login Page design using Html and CSS only