What will be the output of this code? a = [[0]*3]*3 a[0][0] = 1 print(a) A) [[1, 0, 0], [0, 0, 0], [0, 0, 0]] B) [[1, 0, 0], [1, 0, 0], [1, 0, 0]] C) Error D) Something else? Drop your answer below 👇 #Python #Programming #Coding #DeveloperLife
Python List Multiplication and Assignment
More Relevant Posts
-
💻 Daily Python Question class Test: x = 10 @classmethod def show(cls): return cls.x @staticmethod def display(): return Test.x print(Test.show(), Test.display()) 👇 Output kya hoga? A: 10 10 B: Error C: None None D: 10 Error 👉 Answer: 10 10 Concept: ✔ Classmethod → class access ✔ Staticmethod → direct access 🚀 OOP clear = next level coding #Python #OOP #Coding #Developers #Programming
To view or add a comment, sign in
-
-
Day 8/365: Reversing a List Without Using Built‑in Functions 🔁🧠 Today I revisited a very common operation in programming: reversing a list. But instead of using Python’s built‑in methods like reverse() or slicing (n[::-1]), I implemented the logic manually using two pointers and a while loop. Why this exercise matters: 1. It forces me to think about how data is stored and changed in memory. 2. I practiced the two‑pointer technique, which is used a lot in array and string problems. 3. It reminded me that behind every “simple” built‑in method, there is an actual algorithm. Day 8 done ✅ 357 more to go. If you have similar two‑pointer problems (like checking palindromes or partitioning arrays), send them my way — I’d love to try them next. #100DaysOfCode #365DaysOfCode #Python #LogicBuilding #TwoPointers #ListManipulation #CodingJourney #LearnInPublic #AspiringDeveloper
To view or add a comment, sign in
-
-
Just discovered a counter-intuitive Python typing edge case: When defining a Protocol for async generators, you must either drop the `async` keyword from the interface signature or include a dummy `yield` expression. Otherwise, the type checker treats it as a Coroutine return type, breaking compatibility with async generator implementations. #Python #Programming #SoftwareDevelopment #Coding #Tech
To view or add a comment, sign in
-
-
Most beginners think variables are just “boxes” 📦 That’s wrong. A variable is just a label pointing to data in memory. 👉 Example (Python): x = 10 Now x is not the value It just points to 10 👉 Change it: x = 20 Now it points somewhere else This is why: - Bugs happen - Values “change” unexpectedly If you don’t understand this, you’re just memorizing syntax—not coding. #coding #python #javaprogramming #learncoding #beginners #programming #developer #softwaredevelopment #tech #codinglife
To view or add a comment, sign in
-
-
🚀 Day 24 – Check if a List is Sorted (Python) 💻 Today’s task: Implement a function to check whether a list is sorted or not. 🔍 The goal is to verify if elements are in ascending (or descending) order. 📌 This exercise helped me understand: • List traversal 🔁 • Comparison logic ⚙️ • Writing clean and efficient functions ✨ ✨ A simple yet important problem for building strong programming fundamentals. 📈 Staying consistent and improving step by step. #Python #100DaysOfCode #CodingJourney #Programming #ProblemSolving #Developer #LearnToCode #Tech #PythonTips #DataStructures
To view or add a comment, sign in
-
-
🚀 Day 3/100: Mastering Logic Flow & Decision Making! 🏝️ The #100DaysOfCode journey is heating up! Today was all about Control Flow and Conditional Logic in Python. I built a "Treasure Island" text adventure game to practice: ✅ Nested if/elif/else statements ✅ Complex logical operators (AND / OR) ✅ Managing user input edge cases Understanding branching logic is a massive step toward building robust automation scripts and handling real-world data scenarios. ⚔️ Check out my code here: 🔗 https://lnkd.in/gxyRjpGh Onward to Day 4! 🚀 #Python #100DaysOfCode #LogicBuilding #Programming #DevLife #GrowthMindset #CodeNewbie
To view or add a comment, sign in
-
🚀 Day 11 – Palindrome Check in Python 💻 Today’s task: Write a program to check whether a string is a palindrome. 🔍 A palindrome is a string that reads the same forward and backward (e.g., madam, racecar). 📌 This exercise helped me understand: • String manipulation 🧩 • Reversing techniques 🔁 • Writing clean conditional logic ⚙️ ✨ Simple problem, but great for strengthening core programming concepts. 📈 Staying consistent and improving every day. #Python #100DaysOfCode #CodingJourney #Programming #ProblemSolving #Developer #LearnToCode #Tech #PythonTips
To view or add a comment, sign in
-
-
🚀 Python 3.13+ is a game-changer: Free-threading (no-GIL mode) and experimental JIT boost multithreaded code by 2-5x! Speed gains are real for CPU-heavy tasks. Tested a simple parallel sum script—3x faster than 3.12. Python 3.15 stabilizes JIT fully. Here’s the snippet: # Run with: python3.13 -X free-threading import threading def compute(n): return sum(i*i for i in range(n)) threads = [threading.Thread(target=compute, args=(10**7,)) for _ in range(4)] for t in threads: t.start() for t in threads: t.join() print("Done!") Who’s upgraded? Share your benchmarks below! 👇 #Python #Python313 #Programming
To view or add a comment, sign in
-
-
Small code. Smart validation. 💡 Today I built a simple Python logic to validate phone numbers in different formats — and it reminded me how powerful basics can be. From checking length to handling formats like: ✔️ 03XXXXXXXXX ✔️ 03XX-XXXXXXX ✔️ +92XXXXXXXXXX This small logic represents something bigger: 👉 Clean input validation 👉 Better user experience 👉 Error prevention in real systems As developers, we don’t just write code — We make systems reliable. Every small project like this improves logic, accuracy, and real-world readiness 🚀 If you're learning programming, focus on the basics — That’s where real strength is built. #Python #CodingJourney #LearnToCode #DeveloperLife #ProblemSolving #TechSkills #BuildInPublic
To view or add a comment, sign in
-
-
After years of reading and writing code, I find that the dumbest code is the best code. It doesn't matter if it's C#, C++, or Python. Make your code simple. Don't use complex abstractions or difficult syntactic sugar, and you'll have a codebase that anyone can jump into and quickly add features without introducing bugs (or bugs that are less likely to happen). This matters more than anything else.
To view or add a comment, sign in
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
B will be the answer.