🚀 Day 10 of Python Learning: Strings in Python Today I learned about Strings — one of the most commonly used data types in Python for working with text data. 🔹 What is a String? A string is a sequence of characters enclosed in single quotes, double quotes, or triple quotes. 🔸 Creating Strings name = "Rohit" city = 'Meerut' 🔸 Accessing Characters print(name[0]) # First character print(name[-1]) # Last character 🔸 String Slicing print(name[0:3]) # Roh print(name[2:]) # hit 🔸 Common String Methods text = "python learning" print(text.upper()) # PYTHON LEARNING print(text.lower()) # python learning print(text.title()) # Python Learning print(text.replace("python", "Java")) 🔸 String Length print(len(name)) 💡 Key Learning: Strings are immutable, which means individual characters cannot be changed directly. 🧪 Practice Task: ✔ Create a string with your name ✔ Print first and last character ✔ Convert text to uppercase ✔ Replace one word in a sentence 🎯 Interview Question: What is the difference between list and string in Python? Answer: A string stores text characters and is immutable, while a list stores multiple values and is mutable. 📌 Day 10 completed — consistency creates success! #Python #Learning #CodingJourney #Day10 #Programming #SDET #100DaysOfCode Masai #dailyleaning #masaiverse
Python Day 10: Strings and String Methods
More Relevant Posts
-
✨Ever wondered how Python handles text behind the scenes? What seems like simple words and sentences are actually powered by one of the most fundamental data types in programming—strings. Understanding strings is not just about printing text; it's about unlocking the ability to manipulate, analyze, and transform data effectively. 🚀 The Rest I’ve just published an article at Innomatics Research Labs that dives into the fascinating world of Python strings—designed especially for beginners who want clarity without complexity. In this guide, you’ll explore: ✨ What strings are and why they matter ✨ Key characteristics like immutability ✨ Different ways to create strings in Python ✨ Techniques to access and work with string elements Thanks to my trainer Rohit Rahangdale and mentor VishnuVardhan Deshmuk for continuous support in my learning journey. A special mention to: Vishwanath Nyathani Raghu Ram Aduri Kanav Bansal Sigilipelli Yeshwanth 🔗 Read the full article here: https://lnkd.in/gKAKWNdw #Python #Programming #LearnToCode #PythonBasics #CodingJourney #TechSkills
To view or add a comment, sign in
-
🚀 Day 8 of Python Learning: Tuples and Sets in Python Today I learned about Tuples and Sets — two important data structures in Python used for storing collections of data efficiently. 🔹 What is a Tuple? A tuple is an ordered collection of items that cannot be changed after creation (immutable). 🔸 Creating a Tuple my_tuple = (1, 2, 3, 4, 5) 🔸 Accessing Elements print(my_tuple[0]) # First element print(my_tuple[-1]) # Last element 🔹 What is a Set? A set is an unordered collection of unique items. Duplicate values are automatically removed. 🔸 Creating a Set my_set = {1, 2, 3, 4, 4, 5} print(my_set) Output: {1, 2, 3, 4, 5} 🔸 Adding Elements my_set.add(6) 🔸 Removing Elements my_set.remove(3) 💡 Key Learning: Use tuples when data should not change, and sets when you need unique values only. 🧪 Practice Task: ✔ Create a tuple of 5 numbers ✔ Create a set with duplicate values ✔ Add and remove elements from a set ✔ Print all tuple values using a loop 🎯 Interview Question: What is the difference between list, tuple, and set in Python? Answer: List is ordered and mutable, tuple is ordered and immutable, while set is unordered and stores only unique values. 📌 Day 8 completed — learning one step at a time! #Python #Learning #CodingJourney #Day8 #Programming #SDET #100DaysOfCode Masai #masaiverse #dailylearning
To view or add a comment, sign in
-
🚀 Day 12 of Python Learning: File Handling in Python Today I learned how Python can create, read, write, and update files. File handling is very useful for storing data permanently. 🔹 What is File Handling? File handling allows us to work with text files and save information outside the program. 🔸 Opening a File file = open("data.txt", "r") 🔸 Reading a File print(file.read()) 🔸 Writing to a File file = open("data.txt", "w") file.write("Hello Python") 🔸 Appending Data file = open("data.txt", "a") file.write("\nNew Line Added") 🔸 Best Practice: Close File file.close() 🔸 Better Way Using with Statement with open("data.txt", "r") as file: print(file.read()) 💡 Key Learning: Using "with open()" is safer because Python automatically closes the file after use. 🧪 Practice Task: ✔ Create a file and write your name ✔ Append your city name ✔ Read the file content ✔ Count total lines in the file 🎯 Interview Question: What is the difference between "w" and "a" mode in Python file handling? Answer: "w" mode overwrites existing content, while "a" mode adds new content at the end of the file. 📌 Day 12 completed — learning practical Python skills daily! #Python #Learning #CodingJourney #Day12 #Programming #SDET #100DaysOfCode Masai #masaiverse #Dailylearning
To view or add a comment, sign in
-
Python Learning Journey – Dictionaries Deep Dive Dictionaries are one of the most powerful and flexible data structures in Python. Today, I explored some important functions that every developer should know 👇 📌 Core Dictionary Functions: ✔️ len() – Returns number of key-value pairs ✔️ clear() – Removes all elements ✔️ get() – Access values safely without errors ✔️ pop() – Removes specific key and returns its value ✔️ popitem() – Removes last inserted key-value pair ✔️ keys() – Returns all keys ✔️ items() – Returns key-value pairs ✔️ copy() – Creates a shallow copy ✔️ setdefault() – Returns value of key (adds if not present) ✔️ update() – Updates dictionary with new key-value pairs 💡 Advanced Concept: ✨ Dictionary Comprehension – A concise way to create dictionaries in a single line Example: {x: x*x for x in range(5)} 🎯 Mastering dictionaries helps in writing efficient and clean code, especially when working with real-world data. #Globalquesttechnologies #GR Narendra Reddy #Python #CodingJourney #100DaysOfCode #Programming #SoftwareDevelopment #PythonBasics #Learning
To view or add a comment, sign in
-
-
Assalam o Alaikum 👋 💡 Python Tip: Stop Writing Extra Code — Use "enumerate()"! If you’re learning Python, this small function can make your code cleaner and smarter 🚀 What is "enumerate()"? "enumerate()" is a built-in Python function that helps you loop through a list while keeping track of the index (position) of each item. 👉 Normally, you do this: You create a counter variable, update it manually, and then access elements. But with "enumerate()"… Python does it for you automatically Example: my_list = ['apple', 'banana', 'cherry'] for index, fruit in enumerate(my_list): print(index, fruit) Output: 0 apple 1 banana 2 cherry Why use "enumerate()"? No need to create a separate counter Cleaner & more readable code Less chance of mistakes Perfect for loops where position matters Pro Tip: You can even change the starting index! for index, fruit in enumerate(my_list, start=1): print(index, fruit) 👉 Now counting starts from 1 instead of 0 🚀 Real Use Cases: • Numbering items in a list • Working with indexed data • Tracking positions in loops • Displaying ordered results If you're learning Python, mastering small functions like this will level up your coding fast! 👉 Follow for more simple Python & AI tips #Python #PythonTips #CodingForBeginners #LearnPython #AIAutomation #TechLearning
To view or add a comment, sign in
-
-
🐍 Learning Python is not about memorizing syntax. It’s about learning how to think logically, step by step. I reviewed a Python Tutorial (Codes) guide, and one thing stood out clearly: Strong Python learning starts with the fundamentals not shortcuts. What I like about this tutorial is that it builds from the core topics that actually matter: * strings * lists * tuples * sets * dictionaries * conditions * loops * functions * exception handling * classes and objects * file reading/writing * lambda functions * list comprehensions * decorators * generators That matters. Because real progress in Python does not come from copying advanced code from the internet. It comes from understanding: * how data is structured, * how logic flows, * how errors happen, * and how code becomes reusable and readable. One thing I especially liked: The tutorial uses practical code examples to move from very basic outputs and data types into more structured concepts like functions, classes, file handling, decorators, and generators. That makes it feel like a real learning path instead of disconnected theory. The uncomfortable truth? A lot of people say they want to learn Python… but get bored at the basics and jump too early into “advanced” topics. That usually slows them down. Because the basics are not the boring part. They are the foundation. 👇 Comment: What do you think is the most important Python skill to master first? A) Data types B) Loops and conditions C) Functions D) Error handling E) Problem-solving mindset #Python #Programming #Coding #PythonTutorial #LearnPython #SoftwareDevelopment #Automation #DataStructures #Functions #ExceptionHandling #OOP #FileHandling #Lambda #Decorators #Generators #CodingJourney #TechSkills #ComputerScience #Developer #PythonLearning
To view or add a comment, sign in
-
🚀 #100DaysOfPython – Day 2: Dictionary & Set Comprehension Yesterday was list comprehension—today, taking it a step further. 👉 Dictionary comprehension squares_dict = {i: i*i for i in range(5)} 👉 Set comprehension unique_squares = {i*i for i in range(5)} ✨ Same idea, different data structures ✨ Clean and expressive 💡 When is this useful? Transforming data into key-value format Removing duplicates (sets) Quick data reshaping ⚠️ Watch out: Overcomplicating comprehensions can hurt readability. If it feels hard to read, use a loop. 🔍 My takeaway: Python gives multiple ways to solve a problem—choose the one that’s easiest to understand later. Read more: https://lnkd.in/dXMCutRw #Python #100DaysOfCode #CodingJourney #LearnPython
To view or add a comment, sign in
-
🚀 Mastering Python Dictionaries I recently published an article that breaks down one of the most important concepts in Python — Dictionaries at Innomatics Research Labs This guide focuses on building a strong foundation with clear explanations and practical examples. 💡 What this article covers: • Understanding dictionaries with real-life examples • Creating and updating key–value pairs • Important methods every beginner should know • Common mistakes and how to avoid them • Clear examples with outputs for better understanding This helped me strengthen my core Python concepts and improve how I think about storing and managing data efficiently. Thanks to my trainer Rohit Rahangdale and mentor VishnuVardhan Deshmuk for continuous support in my learning journey. A special mention to: Vishwanath Nyathani Raghu Ram Aduri Kanav Bansal Sigilipelli Yeshwanth 🔗 Read the full article here: https://lnkd.in/g2kRjfHd #InnomaticsResearchLabs #Innomatics_Research_Labs_JNTU #Python #Programming #DataStructures #Learning #CodingJourney #ProgrammingFundamentals
To view or add a comment, sign in
-
I recently explored Python Lists and how they work in real-world scenarios, and here’s what I learned 👇 Python lists are one of the most powerful and beginner-friendly data structures. They allow us to store multiple values in a single variable and work with them efficiently. In my blog, I covered: • Creating and accessing lists • Indexing and slicing • Adding, removing, and updating elements • Important methods like append(), remove(), sort(), reverse() • Real-world examples like shopping lists, student marks, and to-do lists 🔑 Key Learnings: • Lists are mutable, which makes them flexible for real-time changes • Built-in methods simplify complex operations • Lists are widely used in real-world applications and problem-solving Read the full blog here: https://lnkd.in/g5kK2jPF #Python #DataStructures #Coding #Programming #LearningInPublic #Tech #Beginners A heartfelt thanks to Vishwanath Nyathani, Raghu Ram Aduri, Kanav Bansal, and Mayank Ghai, along with my mentors Harsha Mg for their continuous guidance and motivation.
To view or add a comment, sign in
-
🚀 Day 27 of My Python Learning Journey 🚀 Today I explored one of the most powerful concepts in Python: Polymorphism. 📌 Topics I Learned: 🔹 Advantages of Polymorphism • Improves code reusability • Makes programs more flexible • Reduces complexity • Helps in writing cleaner and scalable code 🔹 Important Terminologies in Python Polymorphism • Method Overriding • Operator Overloading • Duck Typing • Magic Methods 🔹 Duck Typing Philosophy in Python “If it walks like a duck and talks like a duck, then it is a duck.” 🦆 Python does not care about the object type, it only cares whether the required method or behavior is present. 🔹 Operator Overloading Python allows us to redefine the behavior of operators for user-defined objects. Example: + operator can perform different tasks: • Addition for numbers • Concatenation for strings and lists 🔹 Method Overriding A child class can redefine the method of the parent class with its own implementation. 🔹 Magic Methods Used for Operator Overloading • add() → + • sub() → - • mul() → * • truediv() → / • lt() → < • gt() → > • eq() → == 🔹 Error Associated with + Operator Trying to add incompatible data types gives an error. Example: 5 + "Python" Output: TypeError: unsupported operand type(s) for +: 'int' and 'str' Learning polymorphism made me realize how Python gives flexibility to write smart and dynamic code. Excited to learn more every day! 💻✨ Thanks for your support G.R NARENDRA REDDY sir #Day27 #Python #Polymorphism #DuckTyping #OperatorOverloading #MethodOverriding #MagicMethods #PythonProgramming #CodingJourney #LearningPython #FutureDeveloper
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Great summary of Python strings, Rohit! Here is my practice task: name = "Ngan Anh" print(name[0], name[-1]) -> Output: N A print(name.upper()) -> Output: NGAN ANH sentence = "I love Python"; print(sentence.replace("Python", "Coding")) Quick question: Since strings are immutable, does using .replace() create a completely new string object in memory? Thanks for sharing! Rohit Verma