🐍 Python Practice – Day 3 ( 14 out of 50 questions solved) Continuing my Python learning journey and focusing on strengthening problem-solving skills through small coding exercises. 📌 Problems solved today: 🔹 Count vowels in a string 🔹 Reverse a number 🔹 Print the multiplication table of a number 🔹 Find the factorial of a number 📌 List-based problems: 🔹 Find the largest element in a list 🔹 Find the second largest number in a list 🔹 Remove duplicates from a list Each exercise helps improve my understanding of loops, conditions, lists, and basic Python logic. Consistency is the key, and I’m enjoying the process of learning step by step. Looking forward to tackling more problems tomorrow! 🚀 #Python #PythonLearning #CodingPractice Day 2 Count vowels in a string. try: word=str(input("enter a string")).lower() vowel={'a','e','i','o','u'} s=0 for i in word: if i in vowel: s=s+1 print(s) except ValueError: print("Invalid input. enter string") Reverse a number. try: num1 =str(input("Enter a number: ")) num2=num1[::-1] print(num2) except ValueError: print("invalid input. enter a number") Print multiplication table of a number. try: num=int(input("enter a number")) s=1 mult=0 while s<=10: mult=num*s s=s+1 print(mult) except ValueError: print("invalid input") Find factorial of a number. try: num=int(input("enter a number")) fact=1 while num>0: fact=fact*(num) num=num-1 print(fact) except ValueError: print("invalid input") Find the largest element in a list. try: list1=[1,2,3,4,5,6,7,8,898] print(max(list1)) except ValueError: print("error occured. Please check the code") Find the second largest number in a list. try: list1=[1,2,3,4] largest=max(list1) secondlargest=float('-inf') for i in list1: if i != largest and i >secondlargest: secondlargest=i print(secondlargest) except ValueError: print("error occured. Please check the code") Remove duplicates from a list. try: list1=[1,1,2,2,3,3,4,4,5,5,6,6,7,7,8] set1=set(list1) print(list(set1)) except ValueError: print("invalid operation")
Python Practice Day 3: Problem-Solving Exercises
More Relevant Posts
-
🚀 Python Session 3 – Mastering Control Flow Most beginners learn Python syntax… But the real turning point in programming is learning how to control program logic. That’s exactly what I explored in Session 3 of my Python learning journey. 🐍 These concepts are the backbone of decision-making and automation in Python. 🔎 Key Topics Covered 🧠 1. if Statement – Decision Making Allows your program to execute code only when a condition is true. Example: marks = 72 if marks >= 50: print("You passed the exam") ⚖️ 2. if-else Statement – Two Possible Outcomes Example: age = 17 if age >= 18: print("Eligible to vote") else: print("Not eligible yet") This helps programs choose between two paths. 📊 3. elif Ladder – Multiple Conditions Example: score = 85 if score >= 90: print("Grade A") elif score >= 75: print("Grade B") else: print("Grade C") Used when several conditions must be evaluated. 🔁 4. for Loop – Iteration A for loop repeats a block of code for a fixed sequence of values. Example: for i in range(5): print(i) Perfect for tasks like processing datasets or repeating operations. ⏳ 5. while Loop – Condition-Based Loop Runs as long as the condition remains true. Example: count = 1 while count <= 5: print(count) count += 1 🔄 6. for-else and while-else In Python, loops can include an else block that runs when the loop finishes normally. Example: for i in range(3): print(i) else: print("Loop completed successfully") 🧩 7. pass Statement – Placeholder Sometimes a block of code is required syntactically but not implemented yet. Example: if True: pass pass acts as a temporary placeholder while developing programs. 💡 Why These Concepts Matter Control flow helps developers: ✔ Build logical programs ✔ Automate repetitive tasks ✔ Create intelligent decision-making systems Without control statements, programs would simply run line by line without logic. Drop your answer in the comments 👇 Which concept felt the most interesting while learning Python? 1️⃣ if-else 2️⃣ elif ladder 3️⃣ for loop 4️⃣ while loop 🔄 Repost to help another learner Follow along as I continue documenting my Python learning journey step by step. #Python #LearnPython #PythonProgramming #CodingBasics #ControlFlow #ProgrammingLogic #TechLearning #CodingJourney
To view or add a comment, sign in
-
🚀 Day 8 of Learning Python: Error Handling 💻 ✅ Back with a learning update 👉 Today I explored how Python handles errors gracefully using exception handling. This helps prevent programs from crashing and improves user experience. 🔹 Common Python Errors: ZeroDivisionError → Dividing by zeroValueError → Invalid input (e.g., text instead of number)TypeError → Wrong data type usedFileNotFoundError → File does not exist 💡 1. Simple Error Handling try: num = int(input("Enter number: ")) print(10 / num) except: print("Error occurred!")👉 Prevents the program from crashing on invalid input 💡 2. Handling Specific Errors try: num = int(input("Enter number: ")) print(10 / num) except ZeroDivisionError: print("Cannot divide by zero!") except ValueError: print("Please enter a valid number!") 💡 3. Using else try: num = int(input("Enter number: ")) except ValueError: print("Invalid input") else: print("You entered:", num)👉 else runs only when no exception occurs 💡 4. Using finally try: file = open("data.txt") except FileNotFoundError: print("File not found!") finally: print("Execution completed")👉 finally always executes (useful for cleanup) 💡 5. Handling Multiple Errors Together try: a = int(input()) b = int(input()) print(a / b) except (ValueError, ZeroDivisionError): print("Invalid input or division by zero") ⚡ Raising Your Own Error age = int(input("Enter age: ")) if age < 18: raise Exception("You must be 18+") 🔥 Custom Exception (Advanced) class MyError(Exception): pass try: raise MyError("Something went wrong") except MyError as e: print(e) ✅ Key Takeaway: Error handling makes your programs more robust, user-friendly, and professional. #Python #CodingJourney #LearnPython #30DaysOfCode #Programming
To view or add a comment, sign in
-
Most people learning Python struggle with one thing: Classes. This is not due to how class definitions function or their complexity, but is mainly because they are typically explained in a complicated fashion. I recently shared an article where I break down Python classes in the simplest way possible — from basics to intuition, without unnecessary jargon. Furthermore, understanding class definitions is important in Python and as such is also a requirement when writing scalable/dependable systems. If you're learning Python or transitioning into ML, this will make things much clearer. What concept in Python took you the longest to truly understand? ♻️ Repost if you’re betting on yourself this time. ➕ Follow me, Samith Chimminiyan, for such ML-related content. Learning in public 🚀 #Python #MachineLearning #DataScience #Programming #OOP #LearnToCode #Developers
To view or add a comment, sign in
-
I wrote my first blog today. 🚀 While learning Python, I realized something surprising. The hardest part was not writing code. It was understanding why code that looked perfectly fine still failed with an error on the screen. That early struggle taught me an important lesson about patience, attention to detail, and problem-solving in programming. So I wrote a short blog reflecting on that experience and the small mistakes that beginners often face while learning Python. 💻 If you are starting your journey in programming or data analytics, you might find it relatable. I would love to hear your thoughts. Read the blog here: https://lnkd.in/dGZwBJhP #Python #DataAnalytics #Programming #LearningJourney
To view or add a comment, sign in
-
Start learning Python by writing code. Not by watching tutorials. Not by saving playlists. Actually writing code. Because Python looks simple on the surface... but the real value comes when you start using it. Most people stop at basics like: print statements loops if-else And then say "I know Python." But real understanding starts when you go deeper. When you learn things like: ●how data structures actually behave ●how functions organize logic ●how OOP helps structure real systems ●how APIs, files, and databases connect to code ●how automation and scripting solve real problems That's when Python starts becoming useful. This PDF is helpful because it doesn't just show syntax. It walks through Python step-by-step - from fundamentals to real-world concepts like APIs, file handling, multithreading, and more. :contentReference[oaicite:0]{index=0) So instead of jumping between random tutorials, you can build understanding in one structured flow. A simple way to use it: 1. Pick one concept 2. Write code for it 3. Modify it and break it 4. Try to apply it in a small use case That's how skills actually stick. Because Python is not about knowing everything. It's about being able to use it when needed. And that only happens through practice. Not passive learning. Save this sheet so you can revisit it while practicing. Comment #Python and I'll send the full PDF. Follow MOHAMMED DILNAWAZ for More..
To view or add a comment, sign in
-
Whether you want to automate repetitive tasks, analyze data, build websites, or dive into machine learning — Python is the perfect starting point. And the best way to start is by getting solid on the fundamentals. In this guide you will learn every basic Python operation through concise explanations, real code examples, and the exact output you can expect to see when you run them. No fluff, no setup headaches — just Python. #Python #DataEngineering https://lnkd.in/g6bvfhHX
To view or add a comment, sign in
-
Looking for Python learning resources that match your experience level? This ranking of 23 blogs will help you cut through the noise. Data scientists will appreciate PyImageSearch's specialized content on Computer Vision and Deep Learning. Those seeking business applications should check out Practical Business Python. Find the Python blogs that deserve a spot in your bookmarks: https://lnkd.in/gDPtXQCZ
To view or add a comment, sign in
-
🐍 Learning Python step by step! In this lesson, discover how Python Tuples work, when to use them, and how they are different from lists. Perfect guide for beginners. #Python #LearnPython #PythonTuples #PythonForBeginners #PythonCourse #Coding #Programming #DevelopOurself #PythonTutorial #CodeLearning
To view or add a comment, sign in
-
FUNDAMENTALS OF PYTHON It’s safe to say that Python fundamentals go far beyond just assigning variables or understanding iterations. ➠ Iteration, as the name implies, is the process of repeatedly executing a block of code using loops under specific conditions. From what I’ve learned so far: ➠ While loops handle indefinite iteration — they keep running as long as a condition remains true. ➠For loops handle definite iteratio — they run based on a sequence or a fixed range. Now here’s a real question: ➤ How many months do people spend learning functions, commands, operators, and loops… only to later call them “non-fundamentals”? Well… I’m that “someone.” And I moved past all of these about a week ago. Not because they don’t matter—but because this is my way of pushing myself forward and staying motivated for the journey ahead. To anyone on the same path as me: You’re doing well—but we can do even better. April 1st, 2026 marks the first draft on this journey. Hopefully, it won’t be the last. My Current Focus: Algorithm Building & Checking Right now, I’m diving into algorithm design and validation, which is honestly one of the most interesting parts of learning Python. It blends: ➼Basic algebra ➼ Binary thinking ➼Logical problem-solving The math itself is simple enough but improvisation using codes is where the fun begins ➤ First Concept: Guess-and-Check Algorithm (Also known as Exhaustive Enumeration) ➠ This algorithm works when: ➮ You can guess possible solutions, and ➮ You can **check if those guesses are correct** It keeps trying values until: ➮ A solution is found, or all possibilities are exhausted ➤ Simple Applications: ➠Finding square roots and cube roots of integers ➠Solving basic word problems ➠Building number guessing games and simple logic-based games This is just the beginning. More concepts, more challenges, more growth on the road to becoming a Python guru 🐍 Stay tuned. 👨💻👨💻
To view or add a comment, sign in
-
-
In 2026, don’t just learn Python — live it. Think in Python. Build with Python. Grow through Python. Stop saying “I’ll learn Python someday.” Start saying “I’ll build something with Python this month.” Python is beginner-friendly — everyone says that. But what they don’t tell you is this: Learning Python deeply can open doors to web development, data science, automation, AI, and cybersecurity. Python isn’t just a skill — it becomes your superpower when you truly understand it. 🎯 Python Roadmap for 2026 📌 Week 1–2: Build Strong Basics Focus on logic, not just syntax. Understand how things work. 📌 Week 3–4: Data Structures & Functions This is where your coding becomes smooth and confident. 📌 Week 5–6: Object-Oriented Programming (OOP) Start small real-world projects like: Library system, inventory tracker, etc. 📌 Week 7–8: Explore Your Interests Try different areas and discover what excites you. Experiment — your niche will find you. 🚀 How to Learn Effectively Don’t binge-watch tutorials — learn and apply immediately Code daily — even 30 minutes matters Build projects — real learning happens when you solve problems Read others’ code — improve your logic and writing style pdf credit: respective owners follow Middi Apurva for more content
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