Python Strings: Creation, Access, Slicing, Operations and Functions

Today, I learned about Strings in Python and their important concepts: • String Creation – Creating text using single quotes, double quotes, or triple quotes Example: name = "Manoj" msg = 'Python' text = """Learning Python""" • Access Using Index – Accessing characters using position numbers Example: word = "Python" print(word[0]) → P print(word[2]) → t • String Slicing – Getting a part of the string Example: print(word[0:4]) → Pyth print(word[::-1]) → nohtyP • String Operations – Performing actions like joining and repeating Example: "Py" + "thon" → Python "Hi" * 3 → HiHiHi • Special Functions of Strings – Useful built-in functions Example: len(word) → 6 word.upper() → PYTHON word.lower() → python word.replace("P","J") → Jython word.strip() → removes spaces Understanding strings is important because text handling is a major part of programming. #Python #Strings #PythonBasics #Programming #CodingJourney #LearningPython

  • table

To view or add a comment, sign in

Explore content categories