🚀 Day 15 – Python Learning Journey 📌 Topic: Tuples & Tuple Methods Today I learned about Tuples in Python. 🔹 What is a Tuple? A tuple is a collection data type in Python. Ordered ✅ Immutable (cannot change after creation) Allows duplicate values Tuple Methods (Only 2 Methods) Unlike lists, tuples have only 2 built-in methods: 1️⃣ count() Returns the number of times a value appears. numbers = (1, 2, 3, 2, 4, 2) print(numbers.count(2)) # Output: 3 2️⃣ index() Returns the first occurrence index of a value. numbers = (10, 20, 30, 40) print(numbers.index(30)) # Output: 2 ✔ Packing & Unpacking 🎯 Key takeaway: Tuples are faster and useful when data should not change. #Python #CodingJourney #100DaysOfCode #WomenInTech #LearningDaily
Python Tuples: Ordered, Immutable Data Type
More Relevant Posts
-
In Python, if we write: a = b = [ ] Are we creating two lists or just one? Actually, Python creates only one list in memory, and both variables "a" and "b" reference the same object. This happens because assignment in Python doesn’t copy objects. Instead, it simply makes the variables point to the same object in memory. Let’s look at a simple example: a = b = [ ] a.append(1) print(a) print(b) Output: [1] [1] Even though we only modified "a", "b" changed as well. That’s because both variables are referencing the same list. If you want two independent lists, you should create them separately: a = [ ] b = [ ] 📌 Key takeaway: In Python, variables store references to objects, not the objects themselves. #Python #Programming #DataScience #AI #Instant
To view or add a comment, sign in
-
💡 Python Tip – List Comprehension (Write Cleaner Code) While practicing Python today, I explored List Comprehension, a powerful feature that makes code more readable and efficient. Instead of writing a traditional loop, we can generate lists in a single line. 🔹 Example Traditional way: numbers = [] for x in range(10): numbers.append(x*x) Using List Comprehension: numbers = [x*x for x in range(10)] ✅ Benefits Cleaner code Faster execution More Pythonic approach 📌 Small improvements like this can make Python code simpler and more efficient. #Python #PythonTips #Coding #DataEngineering #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 4 of My 45-Day Python Learning Challenge Title: 🐍 Python Learning Challenge – Day 4 Topic: Python Tuples Today I explored Python Tuples and how they are different from lists. 🔹 Tuples are used to store multiple items in a single variable 🔹 They are immutable (cannot be changed after creation) 🔹 Faster and more secure compared to lists 💻 Example I practiced: fruits = ("apple", "banana", "mango") print(fruits[1]) # Access element 📚 Key Takeaways: ✔ Tuples are ordered ✔ No modification (add/remove not allowed) ✔ Useful for fixed data Learning something new every day and building consistency! 💪🐍 #Python #PythonLearning #45DaysChallenge #CodingJourney #LearnToCode #StudentDeveloper
To view or add a comment, sign in
-
-
🐍 Python Made Fun… With Cats! 🐱 Learning Python doesn’t have to be boring. Sometimes, visuals make concepts click instantly. Check out this cute guide to common Python list methods: • append() → Add an item • clear() → Remove everything • copy() → Duplicate the list • count() → Count occurrences • index() → Find position • insert() → Add at a specific spot • pop() → Remove by index • remove() → Remove a specific value • reverse() → Flip the list 💡 Pro Tip: Visuals + repetition = learning faster and remembering longer. 💬 Quick question: Which Python list method do you use the most in your code? #Python #Coding #ProgrammingTips #LearnPython #PythonProgramming #DeveloperLife #TechLearning
To view or add a comment, sign in
-
-
🐍 Python Made Fun… With Cats! 🐱 Learning Python doesn’t have to be boring. Sometimes, visuals make concepts click instantly. Check out this cute guide to common Python list methods: • append() → Add an item • clear() → Remove everything • copy() → Duplicate the list • count() → Count occurrences • index() → Find position • insert() → Add at a specific spot • pop() → Remove by index • remove() → Remove a specific value • reverse() → Flip the list 💡 Pro Tip: Visuals + repetition = learning faster and remembering longer. 💬 Quick question: Which Python list method do you use the most in your code? #Python #Coding #ProgrammingTips #LearnPython #PythonProgramming #DeveloperLife #TechLearning
To view or add a comment, sign in
-
-
DAY 2/30 — PYTHON JOURNEY Today I learned about Variables in Python. Variables allow us to store information inside a program. Example: Python Copy code name = "Samuel" age = 23 is_student = True print(name) print(age) print(is_student) 💡 🔆 What I learned: • Strings store text • Integers store whole numbers • Booleans store True/False values Challenge faced🥹😭: Understanding when to use quotes and when not to can be really annoying.... after feeling yourself then you print and it is giving what you are not expecting. #Day2 #PythonJourney #30DaysOfCode #TechInNigeria #LearningInPublic
To view or add a comment, sign in
-
-
Discovered why Python lists kill performance (200ms vs 2ms for 1M elements!) while NumPy delivers 100x speedup + 8x less memory. Explained with a chef analogy: cache misses = running to the store, GIL = one chef rule. Read full blog on medium: https://lnkd.in/dWDGWtuw #NumPy hashtag #Python hashtag #DataScience hashtag #Performance hashtag #GenAi hashtag #DataScience
To view or add a comment, sign in
-
-
🚀 Day 38 of My Python Learning Journey Today I worked on an interesting Python problem that involved evaluating a polynomial expression using user input. 🔹 The task was to read values for x and k, then take a polynomial expression as input and check whether the polynomial evaluated at x equals k. 💡 This problem helped me understand: • How input() works in Python • How eval() can evaluate mathematical expressions dynamically • How to verify conditions and return True/False 🧠 Key Idea: Evaluate the polynomial expression using eval() and compare the result with the expected value. x, k = map(int, input().split()) poly = input() print(eval(poly) == k) ✨ This exercise strengthened my understanding of Python expression evaluation and logical comparison. Every day of practice brings me one step closer to mastering Python and building strong problem-solving skills. 💻 #Python #CodingJourney #ProblemSolving #Programming #Learning #HackerRank
To view or add a comment, sign in
-
-
One small habit that makes data analysis easier: always check missing values early. In Python with Pandas: df.isnull().sum() This quickly shows how many missing values exist in each column. Catching this early helps you decide whether to drop, fill, or further investigate the data before building any model or analysis. Many issues in analysis come from unnoticed missing data. #Python #DataAnalytics #MachineLearning #DataScience
To view or add a comment, sign in
-
Learning Python step by step and had a small “aha!” moment today while comparing Python lists with NumPy arrays. 👩💻 Here’s the simple way I started thinking about it: 🔹 Python Lists Great for general use Flexible (can hold different data types) But when doing calculations, you usually need loops… which can get slow and a bit tiring for large data. 🔹 NumPy Arrays Designed for numerical operations Much faster for calculations Works naturally with multi-dimensional data (matrices, vectors, etc.) Lets you perform operations on entire arrays at once without writing loops. 💡 My beginner takeaway: If you're just storing data → lists are totally fine. If you're doing heavy calculations or working with numerical data → NumPy becomes a game changer. Still learning and connecting the dots every day, but moments like this make Python even more fun to explore. 🚀 #Python #NumPy #PythonLearning #CodingJourney #BeginnerProgrammer
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