Day 4/30 🔹 Problem: Find the second largest number in a list 🔹 What I focused on today: Thinking beyond the obvious solution and handling edge cases 🔹 My Thinking Process: Take a list of numbers from the user Remove duplicate values Sort the list Pick the second last element 👉 Simple idea, but requires careful steps 🔹 Inputs I used: List of numbers 🔹 Code: numbers = list(map(int, input("Enter numbers separated by space: ").split())) # Remove duplicates numbers = list(set(numbers)) # Sort the list numbers.sort() # Find second largest if len(numbers) < 2: print("Not enough elements") else: print("Second Largest Number:", numbers[-2]) 🔹 Example: Input: 10 20 30 40 Output → 30 🔹 Key Takeaway: Breaking a problem into steps like cleaning data, sorting, and selecting values makes it easier to solve #Day4 #Python #30DaysOfCode #LearningInPublic #DataAnalytics #ProblemSolving
Second Largest Number in a List with Python
More Relevant Posts
-
Day 6/10 🚀 This is where your data starts to take shape. Collections — the backbone of every Python program. Without the right one? Slower code, messy logic. With the right one? Faster lookups, cleaner design. 📋 What I covered today: 01 → Lists — slicing & comprehensions 02 → Tuples — immutability & unpacking 03 → Dictionaries — CRUD & O(1) lookup 04 → Sets — unique values & operations 05 → Frozenset 06 → Advanced — defaultdict, Counter, namedtuple 07 → Iterators — iter() & next() 08 → Mini Project — Inventory Management System Built a simple system using dictionaries to manage stock & pricing — a real-world pattern used in inventory and data pipelines. Day 1 ✅ Day 2 ✅ Day 3 ✅ Day 4 ✅ Day 5 ✅ Day 6 ✅ 4 more to go. Drop a 🐍 if you’ve ever used a list when a set would’ve been better 😄 #Python #Collections #DataEngineering #LearningInPublic #CleanCode #10DaysOfPython #DataStructures
To view or add a comment, sign in
-
🚀 Simplifying Trees in DSA! 🌳💻 While Arrays and Linked Lists are great linear structures, hierarchical data requires a Non-Linear approach—like Trees! To make revising easier, I created this visual cheat sheet. Just like a real-world tree has a Root and Leaves, a Tree data structure starts at the Root Node and branches out to Intermediate and Leaf Nodes. Here is what I have visually summarized in these notes: ✅ The core difference between Linear and Non-Linear structures ✅ 7 Types of Trees (including BST, Strict, Complete, and Skew Trees) ✅ Array Representation vs. Logical View ✅ Tree Traversal logic (Pre-order, In-order, Post-order) complete with Python code! 🐍 Visualizing the flow from the root down to the leaf nodes is a game-changer for understanding algorithms. Take a look and let me know in the comments—what is your favorite data structure to work with? 👇 #DSA #DataStructures #Algorithms #Python #CodingJourney #TechNotes #SoftwareEngineering #LearnInPublic
To view or add a comment, sign in
-
Stop Burning Hours on Boring Stuff. Here’s How. How many of your daily tasks are just… repetitive? 😴 Manually sorting downloads? Renaming a hundred images? Cleaning a CSV by hand? These little time-sinks add up and drain your creative energy. The infographic below shows how Python turns a 3-hour daily grind into a 15-minute background task. The secret? The os and shutil modules. With just a few lines of code, you can build your own automation hero to: ✅ Organize files automatically. ✅ Streamline data workflows. ✅ Eliminate manual errors. ✅ Get back to solving the problems that matter. What repetitive task are you just waiting to automate? Drop it in the comments! 👇 #Python #Automation #DeveloperProductivity #CodingLife #Efficiency
To view or add a comment, sign in
-
-
My thesis was stuck. A matrix had the wrong shape and I had no idea why. I could have printed the entire dataset to find the error. I did not. Instead I used Python's debugger. One breakpoint. One look at the intermediate state. Wrong dimensions. Found in seconds. That moment changed how I work. Not because debugging saved my thesis. But because it taught me something I still use every day: You do not need to see all the data to understand what is wrong. You just need to see the right data at the right moment. Since then, every time a pipeline breaks or a model behaves unexpectedly, I reach for the debugger first. Not print statements. Not guesswork. A breakpoint. An intermediate result. A clear answer. Debugging is not a last resort. It is the fastest way to understand what your code is actually doing. What is your go-to strategy when something breaks unexpectedly? #Python #Debugging #DataScience #MachineLearning #FreelanceDataScientist
To view or add a comment, sign in
-
-
Advanced pandas tricks that make you 10x faster at data wrangling. Most people learn pandas basics and stop. This free notebook covers what comes after. → MultiIndex: hierarchical indexing for complex datasets → .pipe() — chain custom functions into your workflow → Method chaining: write entire analyses in one readable block → Memory optimization: reduce DataFrame memory by 70%+ → Vectorized operations: why your for loop is 100x slower → Performance patterns the documentation buries If your pandas code has more than 2 for loops, this notebook will change how you write it. Every trick has before/after benchmarks. See the speed difference yourself. Free: https://lnkd.in/g7HsJfGy Day 3/7. #Python #Pandas #DataAnalyst #DataScience #DataWrangling #Performance #FreeResources #DataAnalytics
To view or add a comment, sign in
-
Exploring Data Visualization with Bokeh Data becomes powerful when it tells a story—and that’s exactly what visualization helps us achieve. Recently, I explored Bokeh, a Python library designed for creating interactive and visually appealing data visualizations for the web. With Bokeh, you can: • Build interactive plots with zoom, pan, and hover tools • Create dynamic dashboards for real-time insights • Design clean and expressive visualizations with ease What makes Bokeh stand out is its ability to turn static data into interactive experiences, making analysis more engaging and insightful. As I continue learning, I’m excited to dive deeper into building dashboards and integrating Bokeh with real-world datasets. #DataVisualization #Python #Bokeh #LearningJourney #DataScience #Analytics #TIET #ThaparUniversity #ThaparOutcomeBasedLearning #ThaparCoursera #Coursera #UCS654_Predictive_Analytics
To view or add a comment, sign in
-
-
Day 14/100 – Data Structures & Algorithms Today, I worked on the problem “First Unique Character in a String.” Overview The task is to identify the first non-repeating character in a string and return its index. If no such character exists, the result is -1. Approach I used a two-pass strategy: • First pass to store character frequencies using a hashmap • Second pass to identify the first character with a frequency of one Complexity • Time Complexity: O(n) • Space Complexity: O(1) Key Takeaway This problem reinforces how effective hashmaps are for frequency-based problems and how a simple two-pass approach can lead to optimal solutions. Staying consistent and building problem-solving intuition step by step. #Day14 #100DaysOfCode #DSA #Python #LeetCode #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
Continuing from my previous post https://lnkd.in/gtyziw-6 here is the actual implementation part of the same project. In this video, I’ve shown my full Jupyter Notebook workflow where I performed the analysis step by step. What this includes: • Data preprocessing and filtering • Handling missing and incorrect values • Feature-level analysis • Applying statistical logic to derive insights This is where the real learning happened — not in theory, but in execution. Debugging errors, fixing logic, and making sure the output actually makes sense. Still improving, but this is a solid step toward building practical data skills. #jupyter #python #dataanalytics #statisticsproject #handsonlearning #careerbuilding #datasciencejourney
To view or add a comment, sign in
-
Spent ₹0. Built a production-grade analytics pipeline. Here's the exact stack—layer by layer. Every tool is free. Every tool is used by real companies at scale. Swipe to steal it. 👇 — Bookmark this for your next project setup. Which layer of this stack are you strongest in? Tell me below. #DataAnalytics #Analytics #Python #SQL #DataEngineering #BusinessIntelligence #OpenSource
To view or add a comment, sign in
-
Dropping columns in pandas seems straightforward until you run into KeyErrors, accidentally modify your original DataFrame, or realize you needed to keep the original data after all. The drop() method is the foundation, but knowing when to use errors='ignore', when to select columns you want instead of dropping what you don't, and when to drop by null count rather than by name — that is what separates clean data pipelines from fragile ones. These are small habits that make a big difference when you are working with production data at scale. Read the full post here: https://lnkd.in/eStxW_4D #Python #Pandas #DataScience #DataAnalysis #DataEngineering #Analytics
To view or add a comment, sign in
Explore related topics
- Tips for Problem-Solving with Clarity
- How to Solve Real Problems
- Tips for Ideation Techniques in Problem Solving
- Tips for Real-World Problem-Solving in Interviews
- Tips for Finding Simple Solutions to Complex Problems
- How to Manage Duplicate Values in Number Sequences
- How to Ask Questions for Better Problem-Solving Skills
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