Python String Properties and Methods

🚀 𝐃𝐚𝐲 22/60 – 60-𝐃𝐚𝐲 𝐏𝐲𝐭𝐡𝐨𝐧 𝐂𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞 🦾 Today's topic is "𝐒𝐭𝐫𝐢𝐧𝐠𝐬 𝐚𝐧𝐝 𝐭𝐡𝐞𝐢𝐫 𝐩𝐫𝐨𝐩𝐞𝐫𝐭𝐢𝐞𝐬" In Python, strings are sequences of Unicode characters, represented with quotes ('...', "...", 𝒐𝒓 """..."""). They are immutable, meaning you cannot change a string’s contents after it’s created—operations like replace() or concatenation produce new strings instead. Common properties and behaviors include 𝒍𝒆𝒏() for length, indexing (e.g., s[0]), slicing (e.g., s[1:4]), and useful methods such as 𝒖𝒑𝒑𝒆𝒓(), 𝒍𝒐𝒘𝒆𝒓(), and 𝒔𝒑𝒍𝒊𝒕(). 𝐄𝐱𝐚𝐦𝐩𝐥𝐞: 𝘯𝘢𝘮𝘦 = "𝘗𝘺𝘵𝘩𝘰𝘯" 𝘱𝘳𝘪𝘯𝘵(𝘭𝘦𝘯(𝘯𝘢𝘮𝘦))     # 6 𝘱𝘳𝘪𝘯𝘵(𝘯𝘢𝘮𝘦[0])     # P 𝘱𝘳𝘪𝘯𝘵(𝘯𝘢𝘮𝘦[1:4])    # yth 𝘱𝘳𝘪𝘯𝘵(𝘯𝘢𝘮𝘦.𝘶𝘱𝘱𝘦𝘳())   # PYTHON Understanding these operators made me realize how programs make decisions and perform actions based on logic. They may look like simple symbols, but they are essential for writing meaningful code. Step by step, building stronger logic. 😆 #learning #python #consistency #challenge #60days #coding #programming #modules

  • graphical user interface, application

To view or add a comment, sign in

Explore content categories