<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shirsathshrinath on Medium]]></title>
        <description><![CDATA[Stories by Shirsathshrinath on Medium]]></description>
        <link>https://medium.com/@shirsathshrinath112?source=rss-6439b18c8271------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*f4-40mVW4L-V4AYe</url>
            <title>Stories by Shirsathshrinath on Medium</title>
            <link>https://medium.com/@shirsathshrinath112?source=rss-6439b18c8271------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 22:41:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shirsathshrinath112/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Strings in Python: A Beginner-Friendly Guide 
Strings are one of the most commonly used data…]]></title>
            <link>https://medium.com/@shirsathshrinath112/strings-4f7348dc3aab?source=rss-6439b18c8271------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f7348dc3aab</guid>
            <dc:creator><![CDATA[Shirsathshrinath]]></dc:creator>
            <pubDate>Tue, 08 Sep 2026 02:53:23 GMT</pubDate>
            <atom:updated>2026-10-06T02:15:58.786Z</atom:updated>
            <content:encoded><![CDATA[<h3>Strings in Python: A Beginner-Friendly Guide 🐍<br>Strings are one of the most commonly used data types in Python. A string is a sequence of characters enclosed inside single quotes, double quotes, or triple quotes.</h3><p>⚡ TL;DR: A string is just text. Learn 5 things (index, slice, methods, f-strings, immutability) and you can handle text in any Python project.<br>🎯 What you will learn in this guide:</p><p>🔍 How to pick any character using indexes<br>✂️ How to cut out parts of text with slicing<br>🧰 5 must-know methods: upper, lower, strip, replace, split<br>🎨 How to build neat sentences with f-strings<br>⚠️ Why strings can never be changed in place<br>⏱️ Reading time: about 5 minutes. Every example is copy-paste ready.</p><p>📌 What is a String?<br>A string is used to store text or a collection of characters.</p><p>name = “Shrinath”<br>message = ‘Hello World’</p><p>print(name)<br>print(message)<br>Output:</p><p>Shrinath<br>Hello World<br>✏️ Creating Strings<br>Python provides different ways to create strings:</p><p>str1 = ‘Hello’<br>str2 = “Python”<br>str3 = “””This is<br>a multiline<br>string.”””<br>💡 Tip: Triple quotes are useful when you want to write strings across multiple lines.<br>🔍 Accessing Characters<br>Think of a string like a row of lockers. Each locker has a number, and the numbering starts from 0, not 1.</p><p>Each character in a string has an index. Python uses zero-based indexing, which means the first character has index 0.</p><p>word = “Python”</p><p>print(word[0])<br>print(word[2])<br>Output:</p><p>P<br>t<br>You can also use negative indexing:</p><p>print(word[-1])<br>Output:</p><p>n<br>✂️ String Slicing<br>Slicing is like cutting a piece of ribbon: you decide where to start and where to stop.</p><p>Slicing allows you to extract a portion of a string.</p><p>word = “Python”</p><p>print(word[0:3])<br>print(word[2:6])<br>Output:</p><p>Pyt<br>thon<br>📖 Syntax: string[start:end]<br>The end index is not included.<br>🧰 Common String Methods<br>Python provides many useful built-in string methods.</p><p>1. upper()<br>Converts the string to uppercase.</p><p>name = “python”<br>print(name.upper())<br>Output:</p><p>PYTHON<br>2. lower()<br>Converts the string to lowercase.</p><p>name = “PYTHON”<br>print(name.lower())<br>Output:</p><p>python<br>3. strip()<br>Removes unnecessary spaces from the beginning and end.</p><p>text = “ Hello Python “<br>print(text.strip())<br>Output:</p><p>Hello Python<br>4. replace()<br>Replaces one part of a string with another.</p><p>text = “I like Java”<br>print(text.replace(“Java”, “Python”))<br>Output:</p><p>I like Python<br>5. split()<br>Splits a string into a list.</p><p>text = “Python is easy”<br>print(text.split())<br>Output:</p><p>[‘Python’, ‘is’, ‘easy’]<br>🔥 Pro tip: Method names are easy to remember. They say exactly what they do: upper makes UPPER, lower makes lower, strip strips the extra spaces.<br>🔗 String Concatenation<br>We can join two or more strings using the + operator.</p><p>first_name = “Shrinath”<br>last_name = “Shirsath”</p><p>full_name = first_name + “ “ + last_name<br>print(full_name)<br>Output:</p><p>Shrinath Shirsath<br>🎨 String Formatting<br>F-strings are a simple and powerful way to insert variables into strings.</p><p>name = “Shrinath”<br>age = 22</p><p>print(f”My name is {name} and I am {age} years old.”)<br>Output:</p><p>My name is Shrinath and I am 22 years old.<br>💎 Pro tip: Prefer f-strings over + when mixing text and numbers. They are shorter, cleaner and need no str() conversion.<br>✅ Checking a String<br>You can check whether a word or character exists inside a string using in.</p><p>text = “Python is powerful”<br>print(“Python” in text)<br>Output:</p><p>True<br>⚠️ Important: Strings are Immutable<br>Strings in Python are immutable, which means their individual characters cannot be changed directly.<br>word = “Python”</p><p># word[0] = “J” # This will cause an error<br>Instead, create a new string:</p><p>word = “Python”<br>word = “J” + word[1:]</p><p>print(word)<br>Output:</p><p>Jython<br>📋 Quick Cheat Sheet<br>Save this one. It covers almost everything above.</p><p>s[0] # first character<br>s[-1] # last character<br>s[a:b] # slice (b is excluded)<br>s.upper() # UPPERCASE<br>s.lower() # lowercase<br>s.strip() # remove outer spaces<br>s.replace(“a”, “b”)<br>s.split() # string to list<br>f”Hi {name}” # f-string<br>“x” in s # True or False<br>🧠 Mini Challenge<br>Try these in your head first, then check the answers below.</p><p>word = “Python”</p><p>print(word[-2])<br>print(word[1:4])<br>print(word.upper()[:2])<br>Answers:</p><p>o<br>yth<br>PY<br>Got all three right? You have understood strings. 👏</p><p>🌟 Key Takeaways<br>Indexing starts at 0, and -1 means the last character<br>Slicing never includes the end index<br>Methods return a new string, they do not change the old one<br>f-strings are the cleanest way to format text<br>Strings are immutable, so always build a new one<br>🏁 Conclusion<br>Strings are an essential part of Python programming. By understanding indexing, slicing, concatenation, formatting, and string methods, you can easily work with text in Python.</p><p>Once you become comfortable with strings, you will find them useful in almost every Python project, from simple programs to Data Science, Machine Learning, and Web Development.</p><p>Happy Coding! 🚀🐍</p><p>👏 If this helped you, clap and follow for more beginner-friendly Python guides.<br>💬 Which topic should come next: Lists, Dictionaries or Loops? Tell me in the comments.<br>more attractive :</p><p><a href="https://claude.ai/artifact/G4HMJhmvToSxFJMa71L6uA">Strings in Python: A Beginner-Friendly Guide</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f7348dc3aab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>