Strings In Python - Python Notes By Mr. BILRED | TechAmbitionX
Strings in Python — Say Hello to Text | TechAmbitionX Strings in Python — Say Hello to Text A string in Python is just a bunch of characters inside quotes. Single quotes or double quotes — both work: name = "Bilal" greeting = 'Hello World' empty = "" They can contain numbers, symbols, even emojis: info = "Python 3.11 rocks! 🤘" How to Use Strings in Python 1. Concatenation (Joining Strings) first = "Mr. " last = "BILRED" full = first + last print(full) # Mr. BILRED 2. String Length name = "Bilal" print(len(name)) # 5 3. Accessing Characters name = "Bilal" print(name[0]) # B print(name[-1]) # l 4. Slicing Strings (obv that means k "kaatna") print(name[0:3]) # Bil print(name[:4]) # Bila print(name[2:]) # lal 5. String Methods msg = "python is awesome" print(msg.upper()) # PYTHON IS AWESOME print(msg.capitalize()) # Python...