🚀 Day 7 of Python Learning: Lists in Python Today I learned about Lists — one of the most useful data structures in Python for storing multiple values in a single variable. 🔹 What is a List? A list is a collection of items stored in a single variable. It can store different data types like numbers, strings, etc. 🔸 Creating a List my_list = [1, 2, 3, 4, 5] 🔸 Accessing Elements print(my_list[0]) # First element print(my_list[-1]) # Last element 🔸 Updating List my_list[1] = 10 🔸 Adding Elements my_list.append(6) 🔸 Removing Elements my_list.remove(3) 💡 Key Learning: Lists are mutable, which means we can change their values after creation. 🧪 Practice Task: ✔ Create a list of 5 numbers ✔ Add a new number ✔ Remove one number ✔ Print all elements using a loop 🎯 Interview Question: What is the difference between list and tuple in Python? Answer: "List is mutable (can be changed), while tuple is immutable (cannot be changed)." 📌 Day 7 done — building consistency step by step! #Python #Learning #CodingJourney #Day7 #Programming #SDET #100DaysOfCode Masai #dailylearning, #masaiverse
Python Lists: Data Structure and Operations
More Relevant Posts
-
🚀 Python Learning Journey – Day 5: Lists in Python 🐍 Continuing my Python journey, today I learned about Lists, one of the most useful data structures in Python 🔥 📌 Key Takeaways: ✔️ Lists can store multiple values of different data types ✔️ Lists support indexing & slicing just like strings ✔️ Lists are mutable (we can change them anytime) 💻 Basic Example: l1 = [7, 9, "siddu"] print(l1[0]) # 7 print(l1[1]) # 9 📌 List Methods I Practiced: ✔️ sort() → Sorts the list ✔️ reverse() → Reverses the list ✔️ append() → Adds element at the end ✔️ insert() → Adds element at a specific index ✔️ pop() → Removes element using index ✔️ remove() → Removes a specific value 💻 Example: l1 = [1, 8, 7, 2, 21, 15] l1.sort() l1.append(8) l1.insert(3, 8) l1.pop(2) l1.remove(21) print(l1) ✨ Slowly building my foundation in Python step by step. Consistency is key! #Day5 #PythonLearning #CodingJourney #LearnPython #ProgrammingBasics #FutureBusinessAnalys
To view or add a comment, sign in
-
🚀 Day 6 of Python Learning: Functions in Python Today I learned how to organize and reuse code using functions — a key concept for writing clean and efficient programs. 🔹 What is a Function? A function is a block of code that performs a specific task and can be reused whenever needed. 🔸 Creating a Function Example: def greet(): print("Hello, welcome to Python!") greet() 🔸 Function with Parameters Example: def greet(name): print("Hello", name) greet("Rohit") 🔸 Function with Return Value Example: def add(a, b): return a + b result = add(5, 3) print(result) 💡 Key Learning: Functions help reduce code repetition and make programs more structured and readable. 🧪 Practice Task: Create a function to check even or odd Create a function to add two numbers Create a function to find the square of a number 🎯 Interview Question: What is the difference between return and print in Python? Answer: "print displays output on the screen, while return sends the value back to the function caller." #Python #Learning #CodingJourney #Day6 #Programming #SDET Masai #dailylearning #masaiverse #SDET
To view or add a comment, sign in
-
-
Python Learning Journey - Deep Dive into Core Concepts Continuing my Python journey, today I explored some powerful and practical concepts that strengthen problem-solving skills: ◆ Loops in Python - for loop & while loop ◆ Strings in Python Finding length using len() Accessing characters using index & slicing Exploring string methods & formatting ◆ Hands-on Practice Program to accept a string & find its reverse ◆ List Data Structure : Built-in functions: len(), index(), append(), insert(), remove(), clear(), sort() Understanding id() function Aliasing vs Cloning of lists Cloning using slicing & copy() ◆ Operators on Lists Multiplication & Concatenation Relational & Membership operators Advanced Concepts Nested Lists List Comprehension Complete List Data Structure Summary Learning Python is all about consistency, practice, and building logic step by step. #Globalquesttechnologies #GR Narendra Reddy #Python #Coding Journey #Learning Python #Programming #Developers #100DaysOfCode #TechSkills #PythonBasics
To view or add a comment, sign in
-
-
🚀 Day 11 of Python Learning: Loops and Patterns in Python Today I practiced loops in Python and learned how to create patterns using nested loops. This helps improve logic building and problem-solving skills. 🔹 What are Patterns? Patterns are shapes or number/star designs created using loops. They are great for understanding loop control and nested loops. 🔸 Using For Loop for i in range(5): print("*") 🔸 Star Pattern Example for i in range(1, 6): print("*" * i) Output: * ** 🔸 Number Pattern Example for i in range(1, 6): for j in range(1, i + 1): print(j, end=" ") print() 💡 Key Learning: Nested loops are useful when one loop runs inside another loop, especially for patterns and matrix-style problems. 🧪 Practice Task: ✔ Print reverse star pattern ✔ Print square pattern using stars ✔ Print number triangle pattern ✔ Try same patterns using while loop 🎯 Interview Question: What is a nested loop in Python? Answer: A nested loop is a loop inside another loop. It is used when repeated iterations are needed within each cycle of the outer loop. 📌 Day 11 completed — logic building step by step! #Python #Learning #CodingJourney #Day11 #Programming #SDET #100DaysOfCode Masai #dailyleaning #masaiverse
To view or add a comment, sign in
-
📘 Today’s Learning: Python Data Types Today, I explored the fundamentals of Python Data Types under the guidance of Satish Dhawale Sir. Here’s a quick overview of what I learned: 🔹 Text Type – "str" (used for storing text) 🔹 Numeric Types – "int", "float", "complex" 🔹 Sequence Types – "list", "tuple", "range" 🔹 Mapping Type – "dict" (key-value pairs) 🔹 Set Types – "set", "frozenset" 🔹 Boolean Type – "bool" (True/False) 🔹 None Type – "None" Understanding data types is the first step toward writing efficient and error-free Python programs. Grateful for the clear explanation and guidance 🙏 💬 See and comment below — What was your first Python concept? #Python #Programming #LearningJourney #DataTypes #Coding #TechSkills #BeginnerProgrammer
To view or add a comment, sign in
-
-
Day 6/30 – Learning Pandas and Exception Handling in Python 📊 Today I learned about Pandas, a powerful Python library used for working with data. Pandas helps in organizing, analyzing, and manipulating data easily. I also learned about its main data structures like Series and DataFrame, which make handling large amounts of data much more efficient. Along with that, I learned about exception handling in Python. Exception handling helps us manage errors in a program so that it doesn’t crash unexpectedly. Using concepts like try, except, and finally, we can handle errors and make our programs more reliable. These concepts are helping me understand how Python can be used not just for programming, but also for data analysis and building robust applications. Excited to keep learning and exploring more every day. ✨ #Day6 #30DaysOfPosting #PythonLearning #Pandas #ExceptionHandling #CodingJourney #LearningJourney 🚀
To view or add a comment, sign in
-
🚀 Day 5 of Python Learning: Loops in Python Today I learned how to repeat tasks using loops — one of the most powerful concepts in programming. 🔹 What are Loops? Loops help us execute a block of code multiple times without writing it again and again. 🔸 For Loop Used when the number of iterations is known. Example: for i in range(1, 6): print(i) 🔸 While Loop Used when the number of iterations is not known. Example: i = 1 while i <= 5: print(i) i += 1 🔸 Loop Control Statements ✔ break → Stops the loop completely ✔ continue → Skips current iteration ✔ pass → Does nothing (placeholder) 💡 Key Learning: Use "for loop" for fixed iterations and "while loop" for condition-based execution. 🧪 Practice Task: Print numbers from 1 to 10 using a loop Find factorial of a number 🎯 Interview Question: What is the difference between for loop and while loop? Answer: "For loop is used when the number of iterations is known, while loop is used when the condition decides the execution." #Python #Learning #CodingJourney #Day5 #Programming #SDET Masai #dailylearning #masaiverse #SDET
To view or add a comment, sign in
-
-
🚀 Day 13 of Python Learning: Exception Handling in Python Today I learned how to handle errors in Python using exception handling. This helps programs run smoothly even when unexpected issues occur. 🔹 What is Exception Handling? Exception handling is used to catch errors and prevent the program from crashing. 🔸 Basic Example try: num = 10 / 0 except: print("Error occurred") 🔸 Handling Specific Error try: number = int("abc") except ValueError: print("Invalid input") 🔸 Using Finally Block try: print("Start") except: print("Error") finally: print("This always runs") 🔸 Using Else Block try: print(10 / 2) except: print("Error") else: print("No error found") 💡 Key Learning: Using try-except makes programs more reliable and user-friendly. 🧪 Practice Task: ✔ Handle divide by zero error ✔ Handle invalid number input ✔ Use finally block in one program ✔ Create a safe calculator using try-except 🎯 Interview Question: What is the purpose of finally block in Python? Answer: The finally block always executes whether an error occurs or not. It is commonly used for cleanup tasks like closing files or database connections. 📌 Day 13 completed — learning how professionals handle errors! #Python #Learning #CodingJourney #Day13 #Programming #SDET #100DaysOfCode Masai #masaiverse #dailylearning
To view or add a comment, sign in
-
This is what real consistency looks like. Not chasing complex topics too early, but taking time to understand the fundamentals properly. From variables to strings, slicing, and now lists, this is how strong foundations are built. Many people overlook the basics, but this is where real confidence and skill come from. At Hempi, we believe growth is not about speed, but consistency. And this right here is a clear example of that. Keep going. It’s all adding up #LearningJourney #Python #MachineLearning #TechEducation #AIForAfrica #HEMPI
Nutrition & Dietetics Student | Aspiring Physician | Building Digital Skills | Passionate About Health, Nutrition & Preventive Medicine
I’m currently building consistency in my tech journey, and today I explored Lists in Python. At first glance, lists seem simple just a way to store multiple items. But learning how to organize, access, and modify data within a list made me realize how essential they are in programming. It’s interesting how one concept can open the door to so many possibilities working with multiple values, managing data efficiently, and writing cleaner, more flexible code. What stands out to me is this: the more I learn, the more I understand that the “basics” are not basic at all they are powerful tools. From figuring out installation, to understanding variables, strings, slicing, and now lists, I can clearly see my growth. Still learning. Still improving. Still showing up. #MachineLearning #Python #DataScience #TechJourney #BuildInPublic #LearningInPublic #HieliteAcademy #Hempi #PythonBasics #TechSkills
To view or add a comment, sign in
-
-
🚀 My Python Learning Journey Today I explored how Python handles data using File Handling 📁 🔹 File Handling – Overview File handling allows us to store, read, and manage data in files instead of keeping everything in memory. This is useful when working with real-world applications where data needs to be saved permanently. 🔹 Types of Operations ✔️ Read (r) → Read data from file ✔️ Write (w) → Create/overwrite file ✔️ Append (a) → Add data to existing file 🔹 Example # Writing to a file with open("data.txt", "w") as f: f.write("Hello, Python!") # Reading from a file with open("data.txt", "r") as f: print(f.read()) 🔹 Key Concepts ✔️ File modes (r, w, a) ✔️ Opening and closing files ✔️ Using with for safe handling ✔️ Reading and writing data 🔹 Why File Handling is Important 💡 Used to store user data 💡 Helps in logging and saving results 💡 Important for real-world applications 🔹 Learning Outcome Understanding file handling made me realize how programs can interact with external data and store information permanently 🚀 #TeksAcademy #Python #CodingJourney #FileHandling #Programming #LearningJourney
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