Day 3/30 Comparing options is easy… but choosing the better one requires understanding the logic behind it. 🔹 Problem: Compare Simple Interest and Compound Interest 🔹 What I focused on today: Understanding the difference in calculation logic between simple and compound interest 🔹 My Thinking Process: Simple Interest is calculated only on the principal amount Compound Interest is calculated on principal + accumulated interest Compare both results to see how compounding makes a difference 👉 Even small changes in logic can lead to big differences in output 🔹 Inputs I used: Principal amount Rate of interest Time (in years) 🔹 Code: principal = float(input("Enter principal amount: ")) rate = float(input("Enter rate of interest: ")) time = float(input("Enter time (in years): ")) # Simple Interest simple_interest = (principal * rate * time) / 100 # Compound Interest amount = principal * (1 + rate / 100) ** time compound_interest = amount - principal print("Simple Interest:", simple_interest) print("Compound Interest:", compound_interest) 🔹 Example: Principal = 1000, Rate = 10%, Time = 2 years Simple Interest = 200 Compound Interest = 210 🔹 Key Takeaway: Compound interest grows faster because it builds on previous interest, not just the original amount #Day3 #Python #30DaysOfCode #LearningInPublic #DataAnalytics #ProblemSolving
Understanding Simple vs Compound Interest Logic
More Relevant Posts
-
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
To view or add a comment, sign in
-
📁 Day 24: Mastering File Systems & Mail Merging I just automated a tedious administrative task by building a Mail Merge program that handles file I/O and string manipulation with ease! 💡 Fun Fact: The concept of "Mail Merge" dates back to the 1970s with early word processors like WordStar, saving humans millions of hours by separating the content from the contact list. 🚀 Key Features: • File Automation: Reads template files and recipient lists dynamically. • String Cleaning: Uses .strip() and .replace() to personalize content. • Scalable Output: Automatically generates and saves unique letters for every name. Explore the automation logic here: 🔗https://lnkd.in/gwdWmATu #Python #Automation #FileHandling #PythonProjects #Coding #100DaysOfCode
To view or add a comment, sign in
-
🐍 Why 𝐢𝐧𝐩𝐥𝐚𝐜𝐞=𝐓𝐫𝐮𝐞 in Pandas Isn’t Always a Good Idea 🚨It looks convenient… but can lead to unexpected issues. 👉𝐖𝐡𝐚𝐭 𝐝𝐨𝐞𝐬 𝐢𝐧𝐩𝐥𝐚𝐜𝐞=𝐓𝐫𝐮𝐞 𝐝𝐨? It directly modifies the original DataFrame. df.dropna(inplace=True) 👉𝐒𝐨𝐮𝐧𝐝𝐬 𝐞𝐟𝐟𝐢𝐜𝐢𝐞𝐧𝐭? 𝐘𝐞𝐬. 𝐁𝐮𝐭 𝐡𝐞𝐫𝐞’𝐬 𝐭𝐡𝐞 𝐜𝐚𝐭𝐜𝐡👇 ⚠️𝐖𝐡𝐲 𝐢𝐭 𝐜𝐚𝐧 𝐛𝐞 𝐫𝐢𝐬𝐤𝐲: • Original data gets overwritten • Difficult to debug mistakes • No easy way to revert changes 🎯𝐁𝐞𝐭𝐭𝐞𝐫 𝐀𝐩𝐩𝐫𝐨𝐚𝐜𝐡: Instead of modifying data in place, create a new DataFrame: df = df.dropna() 💡𝐖𝐡𝐲 𝐭𝐡𝐢𝐬 𝐢𝐬 𝐛𝐞𝐭𝐭𝐞𝐫: • Keeps original data safe • Easier to track changes • Improves code readability 𝐂𝐨𝐧𝐯𝐞𝐧𝐢𝐞𝐧𝐜𝐞 𝐢𝐬 𝐠𝐨𝐨𝐝, 𝐛𝐮𝐭 𝐝𝐚𝐭𝐚 𝐬𝐚𝐟𝐞𝐭𝐲 𝐢𝐬 𝐛𝐞𝐭𝐭𝐞𝐫. 🔥 #Python #Pandas #DataAnalytics #DataAnalyst #Learning
To view or add a comment, sign in
-
-
Day 11/30 🔹 Problem: Build a calculator using functions 🔹 What I focused on today: Breaking a problem into small reusable functions and controlling flow using a menu 🔹 My Thinking Process: Create separate functions for each operation (add, subtract, multiply, divide) Show a menu to the user Take user choice Call the corresponding function 👉 Functions + menu = clean and organized program 🔹 Inputs I used: Two numbers Operation choice 🔹 Code: def add(a, b): return a + b def subtract(a, b): return a - b def multiply(a, b): return a * b def divide(a, b): if b == 0: return "Cannot divide by zero" return a / b print("1. Add") print("2. Subtract") print("3. Multiply") print("4. Divide") choice = input("Enter your choice: ") num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) if choice == "1": print("Result:", add(num1, num2)) elif choice == "2": print("Result:", subtract(num1, num2)) elif choice == "3": print("Result:", multiply(num1, num2)) elif choice == "4": print("Result:", divide(num1, num2)) else: print("Invalid choice") 🔹 Example: Choice = 1, Numbers = 10 and 5 Output → 15 🔹 Key Takeaway: Using functions makes code modular, reusable, and easier to manage, especially when multiple operations are involved #Day11 #Python #30DaysOfCode #LearningInPublic #DataAnalytics #ProblemSolving
To view or add a comment, sign in
-
The best part of this job is to work with these amazing young people... Tim's "I learn a bit how to program in python"-project turns out to receive >60.000 views on Reddit in a few days. Great reaction diagram plotting possibilities for your #CompChem papers! Customizable and publication-ready. Do not forget to give credit to Tim Enders if you use it...
Manually creating reaction energy diagrams with Matplotlib or other software can be very time-consuming. Therefore, I created a Python package which conveniently handles path drawing, numbering and layout automatically and contains other useful features like image insertion, difference bars, merged plateaus and axis breaks. It also features multiple drawing styles. Collision avoidance is also included. Since it is based on Matplotlib, it remains fully customizable with access to all Matplotlib objects while still speeding up diagram construction significantly. A minimal working example could look like this: dia = EnergyDiagram() dia.draw_path(x_data=[0, 1, 2, 3], y_data=[0, -13, 75, 20], color="blue") dia.add_numbers_auto() dia.set_xlabels(["Reactant", "IM", "TS", "Product"]) dia.show() The package is available on PyPi and can be easily installed with pip: pip install chemdiagrams You can find the links to the project here: GitHub: https://lnkd.in/dARpRWmZ PyPi: https://lnkd.in/dCkBs-mT Documentation: https://lnkd.in/d-WAMJUr I would love to get any feedback! #Chemistry #ComputationalChemistry #TheoreticalChemistry #Visualization #Python #Matplotlib
To view or add a comment, sign in
-
-
🚀 𝗗𝗮𝘆 𝟯 : 𝗧𝗼𝗱𝗮𝘆 𝗜 𝗲𝘅𝗽𝗹𝗼𝗿𝗲𝗱 𝘀𝗼𝗺𝗲 𝗯𝗮𝘀𝗶𝗰 𝗯𝘂𝘁 𝘃𝗲𝗿𝘆 𝗶𝗺𝗽𝗼𝗿𝘁𝗮𝗻𝘁 𝗳𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀 𝗶𝗻 𝗣𝗮𝗻𝗱𝗮𝘀 𝗳𝗼𝗿 𝗱𝗮𝘁𝗮 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱𝗶𝗻𝗴 📊 🔍 1. head() Shows the first 5 rows of the dataset df.head() 🔍 2. tail() Shows the last 5 rows df.tail() 📏 3. shape Returns number of rows and columns df.shape ℹ️ 4. info() Provides summary of dataset (data types, null values) df.info() 📊 5. describe() Gives statistical summary (mean, min, max, etc.) df.describe() 📌 6. columns Shows all column names df.columns 💡 Key Learning: Understanding your dataset is the first step before doing any analysis. #Day3 #Pandas #Python #DataAnalytics #LearningJourney #DataExploration
To view or add a comment, sign in
-
Day 43 of LeetCoding everyday until I get a J-O-B: Check If a String Contains All Binary Codes of Size K. If K = 2, the possible codes are 00, 01, 10, 11. We need to prove every combination exists inside our string. The Noob Trap: Generating all $2^k$ combinations upfront to cross them off. If K = 20, you need over a million strings. You just blew up your RAM. The Senior Fix: Math & Sliding Windows 1. The Math Filter: For a string to even physically fit all combinations, its length must be at least 2^k + K - 1. If it's shorter? Instant return False. Just like my job applications. 2. The Set: We slide a window of size K across the string, dumping every slice into a Python Set (which automatically vaporizes duplicates). 3. The Check: At the end, we check if len(seen) == (1 << k). (We use a Bitwise Left Shift because we are elite). See more: https://lnkd.in/gUki2imQ #LeetCode #Python #DataStructures #Engineering #TechHumor
To view or add a comment, sign in
-
Learning Excel array functions becomes much more intuitive when connected with NumPy array thinking. Some powerful Excel dynamic array functions and their NumPy logic: • FILTER() → like NumPy boolean filtering • UNIQUE() → similar to np.unique() • SORT() → works like np.sort() • SEQUENCE() → similar to np.arange() • INDEX() → position-based extraction like array indexing • XMATCH() → locating values similar to np.where() • TAKE() → slicing selected rows or columns • DROP() → removing portions of an array • HSTACK() → horizontal array combination • VSTACK() → vertical array combination • TRANSPOSE() → matrix flipping using .T • CHOOSECOLS() → selecting specific columns • CHOOSEROWS() → selecting specific rows • TOCOL() → flattening into one column • TOROW() → flattening into one row The strongest learning shift: Instead of thinking cell by cell, think in arrays. One formula, multiple results, dynamic output. This same logic strengthens Excel, Python, and analytical thinking together. #Excel #NumPy #Python #DynamicArrays #DataAnalytics #LearningJourney #SpreadsheetSkills
To view or add a comment, sign in
-
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
-
#𝐃𝐚𝐲𝟏𝟕 – 𝐑𝐨𝐭𝐚𝐭𝐢𝐨𝐧 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 🚀 Find max value of F(k) = 0×arr_k[0] + 1×arr_k[1] + ... + (n-1)×arr_k[n-1] where arr_k is nums rotated by k. Naive approach: O(n²) → too slow for n = 1e5 Optimized approach: Find recurrence relation! F(k) = F(k-1) + S - n × nums[n-k] where S = sum(nums) Step 1: Compute F(0) directly Step 2: Use recurrence for F(1) to F(n-1) Step 3: Track maximum Time: O(n) | Space: O(1) Math is the ultimate optimization tool! 🎯 #LeetCode #Python #100DaysOfCode #Math #Optimization
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