Hello connections 👋 Welcome to Day 3 of my Python problem-solving series! Consistency is the key to growth, so here is today’s challenge 🚀 🧠 Day 3 Challenge: Find Factorial of a Number The factorial of a number n is the product of all positive integers less than or equal to n. 👉 Example: Input: 5 → Output: 120 (5 × 4 × 3 × 2 × 1 = 120) My Approach: Using Loop num = int(input("Enter a number: ")) fact = 1 if num < 0: print("Factorial does not exist for negative numbers") else: for i in range(1, num + 1): fact *= i print("Factorial =", fact) 📌 Explanation: We multiply all numbers from 1 to num. Now it’s your turn 👇 Try solving it with your own logic or suggest a better approach in the comments. Let’s learn and grow together 🚀 #Python #CodingChallenge #ProblemSolving #Programming #30DaysOfCode
Python Factorial Challenge Day 3
More Relevant Posts
-
🚀 Day 8 of My Python Learning Journey Today, I built a Menu-Driven Calculator Program in Python 🧮 💡 What I learned & implemented: Creating functions (def) for reusable code Performing operations like Addition, Subtraction, Multiplication, Division, and Average Using conditional statements to control program flow Taking user input for dynamic calculations 🧠 Mini Project: Calculator Program I designed a calculator that allows users to: ✔ Select an operation from a menu ✔ Input numbers ✔ Get results instantly 📌 Functions Created: add() → Addition sub() → Subtraction multiply() → Multiplication (and more...) 🔍 Key Learning: Breaking a problem into smaller functions makes the code cleaner, reusable, and easier to manage. 💭 This is helping me build a strong foundation for writing scalable and structured programs. 🚀 Next Step: Loops & Advanced Logic Implementation https://lnkd.in/gJrKBVi3 #Python #LearningJourney #100DaysOfCode #Coding #DataAnalytics #Functions #ProblemSolving
To view or add a comment, sign in
-
🎯 Tech Learning Journey - Day 05: Python Error Handling - Graceful Failures! Error handling lets your code handle unexpected situations without crashing completely. Instead of your program stopping when something goes wrong, you catch the problem and decide what to do next. try: result = 10 / 0 except ZeroDivisionError: print\("Oops, you can't divide by zero!"\) result = 0 print\(f"Result: \{result\}"\) # Still runs smoothly Where I use this: User input validation, API calls that might fail, and file operations that could go wrong. #Python #Coding #Programming #ErrorHandling
To view or add a comment, sign in
-
-
🚀 Day 13 – Second Largest Number in a List (Python) 💻 Today’s task: Find the second largest number in a list. 🔍 Explored how to handle: • Duplicate values 🔁 • Edge cases (small lists, same elements) ⚠️ • Efficient comparison logic ⚙️ 📌 This exercise helped me improve: • Logical thinking 🧠 • List manipulation skills 📋 • Writing optimized solutions ✨ ✨ Simple problem, but important for building a strong foundation in problem-solving. 📈 Learning something new every day with consistency. #Python #100DaysOfCode #CodingJourney #Programming #ProblemSolving #Developer #LearnToCode #Tech #PythonTips
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 4 of Python Journey – Conditional Statements After a short break, started again my python journey. Today, I focused on Conditional Statements in Python. Instead of just understanding theory, I worked on multiple implementations and practiced different variations to strengthen my logic building. 📂 What I covered: ✔ if statements ✔ if-else statements ✔ if-elif-else ladder ✔ Solved multiple questions based on conditions ✔ Built small logic-based programs One of the highlights was creating a temperature-based decision system using an if-elif ladder — simple concept, but great for understanding how decision-making works in real programs. 💡 Key Learning: It’s not about solving one question. It’s about solving many variations of the same concept until the logic becomes natural. 📈 Approach I’m following: Learn → Practice → Repeat → Improve This is just Day 4, but the focus is clear — building strong fundamentals that will help in problem-solving and real-world development. #Python #CodingJourney #100DaysOfCode #Programming #Learning #Consistency #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 23 – Second Non-Repeating Character (Python) 💻 Today’s task: Find the second non-repeating character in a string. 🔍 The goal is to identify the second character that appears only once in the given string. 📌 This exercise helped me understand: • Character frequency counting 🔢 • String traversal 🔁 • Handling edge cases efficiently ⚠️ ✨ A slightly advanced twist on a common problem that improves logical thinking. 📈 Learning consistently and strengthening problem-solving skills every day. #Python #100DaysOfCode #CodingJourney #Programming #ProblemSolving #Developer #LearnToCode #Tech #PythonTips #DataStructures
To view or add a comment, sign in
-
-
Hello everybody, and welcome to this second personal project of 'Learning Python with me'. Today, I have been asked to create a commission calculator for a friend, and we will use Python to make a simple calculator that shows the percentage commission. What do we need? - Name - Income - Commission result Throughout this project, I realized that I needed to convert strings into integers, since the final result had to be a number. I also learned how to use variables in mathematical operations and print them as a final result. Here is how it looks. I hope you enjoy it! :) #Python #PythonProject #SideProject #fyp #Programming #OpsDeveloper
To view or add a comment, sign in
-
📘 Python Learning – Day 7 Highlights 🐍 Today’s class was all about improving coding efficiency and writing cleaner Python code 👇 🔹 Loops Revision: Practiced for & while loops with real examples 🔹 Loop Control: Used break, continue, and enumerate() for better control 🔹 List Comprehension: Learned a shorter, more Pythonic way to create lists in one line 🔹 Functions Basics: ✔ Reusable code using def ✔ Passing arguments & returning values 🔹 Utility Functions: Small, reusable functions for common tasks (like even/odd check, calculator, etc.) 💡 Example: [x**2 for x in range(1,6)] → creates squares in one line Writing cleaner, smarter, and more efficient code step by step 🚀 #Python #Programming #Coding #LearningJourney #Beginner #TechSkills
To view or add a comment, sign in
-
-
Day 8/30 – Python Coding Challenge 🐍 📌 LeetCode Problem 11: Container With Most Water 💡 Problem: Find two lines that form a container holding the maximum water. 🧠 What I learned: • Two-pointer technique • Optimizing brute force (O(n²) → O(n)) • Smart decision making using minimum height 💻 Example: Input: [1,8,6,2,5,4,8,3,7] Output: 49 🚀 Insight: By moving the pointer with smaller height, we can efficiently maximize the area. Learning to think smarter, not harder 💪 #30DaysOfCode #Python #LeetCode #TwoPointers #CodingChallenge #ProblemSolving
To view or add a comment, sign in
-
-
Day 5/30 This looked correct… until I actually ran it def add(a, b): return a + b Nothing looks wrong here. But then: add("10", 5) It fails Not when I wrote the function… not when Python read it… only when it ran. That’s how I learnt : ➡️ Function definitions don’t enforce types ➡️ The real check happens during execution So the code can look completely fine… and still break later. And that changes how you think about writing code #Python #LearningInPublic #Programming #Developers #30DaysofCode #CodingJourney
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