DAY 4(CODE INFINITY)
When I was writing these programmes I thought these all are simple commands which is in everybody's notebook so what is the purpose of writing then I realized there is a purpose and that is to maintain consistency and line wise all the content in one go . Today I am giving a code which gives output to all the commands which we used to study in string slicing so Let's get started...…
name= "Shweta"
print(name[5])
slicing=name[0:4]
print(slicing)
print("name is break")
for character in name:
print(character)
print(name.upper())
print(name.lower())
print(name.capitalize())
print(name.center(45))
print(name.count("t"))
print(name.startswith("m"))
print(name.endswith("t"))
print(name.find("h"))
print(name.isalnum())
print(name.isalpha())
print(name.islower())
print(name.isprintable())
print(name.title())
print(name.istitle())
print(name.swapcase())
print(name.isupper())
Screenshot of the repel which shows how it run and what are outputs of given commands:
link of the repel is:
https://replit.com/@shwetaantil97/Python#main.py
Comments
Keep it up .... 💯👍 & Do your work with full Consistency and Patience.