They wanted the maximum of 5 numbers. The program printed 0. Every number was negative. max = 0 fails when all inputs are negative. Read the first number into max, then loop for the rest. One idea, two bugs avoided. I wrote a beginner guide that covers two classics in one: ✅ Maximum of N numbers — read first into max, loop N−1 times, update if larger (and why not max = 0) ✅ Decimal to binary — divide by 2, collect remainders, reverse. In code: prepend to a string. ✅ Why the "build as number" method loses leading zeros (and why string method is correct) ✅ Full programs: max of N and decimal-to-binary with n=0 handled ✅ Summary, takeaways, and next steps (min, binary→decimal) ~6 min read. Straight to the point. https://lnkd.in/gqJWam9x #Python #Programming #Coding #Beginners #LearnToCode #Maximum #DecimalToBinary #Binary #WhileLoop #Practice #Tech #SoftwareDevelopment #CodingTips
Vimal Thapliyal’s Post
More Relevant Posts
-
Day 79 of #100DaysOfCode: Recursive Optimizations! , Recursion can be creatively adapted for different mathematical operations beyond traditional factorial calculations. Key insight: • Square root factorial multiplies √n recursively instead of n, producing smaller growth rates • Same recursive structure but different operation yields unique mathematical sequences GitHub: https://lnkd.in/gjdb5mkT #Python #Coding #100DaysOfCode #Programming #LearnToCode #Recursion
To view or add a comment, sign in
-
-
How do you explain a “function” to a newbie?🤔 For me, the simplest way is this: a function is a reusable tool for a specific task. ✨ Think about it like this: when you want to sweep your floor, you don’t reinvent the broom every time, right? You grab the broom, sweep, and done. ✅ In programming, a function works the same way. Once you’ve written it, you can reuse it anywhere you need that task done. No need to repeat the steps from scratch. So the next time someone asks you what a function is, don’t get lost in technical jargon. Just say: “It’s your broom in the coding world. Once you have it, you just keep using it.” 😉 What everyday object would you compare a function to? #Programming #Python #BackendDevelopment #SoftwareEngineering #LearnigInPublic
To view or add a comment, sign in
-
🧠 I built my own programming language — GreyMatter! Inspired by Grey Matter from Ben 10 (yes, the alien genius 😄), I created a fully functional interpreted programming language built in Python using SLY. GreyMatter supports: ✅ Variables, loops, and conditionals ✅ User-defined functions with FEEDBACK (return values) ✅ String utilities like WAYBIG() (uppercase) and NANOMECH() (lowercase) ✅ Time utilities via PARADOX.SLEEP() and PARADOX.UNIDATE() ✅ A memory system called BRAINSTORM ✅ Even experimental @WEB_SEARCH and @AI query features! The whole interpreter works through Lexical Analysis → Parsing → AST Generation → Runtime Execution. This project taught me how real-world languages like Python and JavaScript actually work under the hood. If you're a CS student or a curious developer, building your own language is one of the most valuable things you can do. 🔗 GitHub: github.com/Abineshabee #Programming #Python #ComputerScience #OpenSource #LanguageDesign #StudentProject #Interpreter #Ben10 #GreyMatter #BuildInPublic
To view or add a comment, sign in
-
Turning logic into patterns is where programming truly begins. 🧠💡 Recently, I explored different Python pattern problems — from number triangles to character pyramids — and realized something important: 👉 These simple-looking patterns actually build strong problem-solving skills 👉 They improve loop control, logic building, and thinking structure 👉 They form the foundation for mastering advanced concepts in programming What seems basic at first becomes powerful with consistency. Every line of code is not just output — it’s training your brain to think like a developer. 🚀 Small steps. Daily practice. Big growth. I’m continuing my journey to strengthen core programming skills — what about you? #Python #Programming #Coding #SoftwareDevelopment #Developers #LearnToCode #CodingJourney #TechSkills #ProblemSolving #CareerGrowth #ContinuousLearning #StudentLife #Upskill #100DaysOfCode
To view or add a comment, sign in
-
-
These concepts help in decision-making within programs, allowing code to respond dynamically based on different conditions. * Explored if-elif-else statements * Worked with Boolean values (True / False) * Built small logic-based programs like grading systems and login validation Mastering these basics is a strong step toward building real-world applications and strengthening problem-solving skills. #Python #Coding #Learning #DataAnalytics #Programming #Beginners #100DaysOfCode
To view or add a comment, sign in
-
𝐇𝐎𝐖 𝐈 𝐎𝐏𝐓𝐈𝐌𝐈𝐙𝐄𝐃 𝐏𝐘𝐓𝐇𝐎𝐍 Your Python runs slow. I cut run time. Three steps worked for me. - Change code in small bits. - Test each change fast. - Track only run time. - Use tips from online. Before: 3 hours. After: 1 hour. Speed up 67%. Apply these steps. Your code will improve. Source: https://lnkd.in/g5Umsa-t #webdev #programming #productivity
To view or add a comment, sign in
-
Day 3: Mastering Operators! 🚀 Today, I learned how to make my code "think" using Operators. These are the tools that let us do math and create logic in programming. What I practiced today: ✅ Math Operators: Using +, -, *, /, and % for calculations. ✅ Comparison: Using ==, >, and < to compare values. ✅ Logical Thinking: Using and, or, and not to build smart conditions. I have practiced these concepts with real examples and pushed all my code to Github💻 Small steps every day lead to big results. #Coding #Python #Learning #Codegnan
To view or add a comment, sign in
-
-
Why simple solutions are the hardest? Making something “work” is easy. You write code, add conditions, stack abstractions — and eventually it runs. But making it clear, readable, and maintainable? That’s where things get difficult. I’ve seen C++ and Python code where layers of abstraction were added “for scalability,” but instead turned a simple idea into something almost impossible to reason about. The irony is: the more experience you gain, the more you start removing code, not adding it. As C. W. Ceram once said, “Genius is the ability to reduce the complicated to the simple.” In practice, this means resisting the urge to over-engineer. A straightforward function is often better than a “clever” architecture no one understands. Simple doesn’t mean primitive — it means deeply understood. What about you — have you ever simplified something and realized it became better, not worse? Share your example in the comments 👇 #softwareengineering #programming #cleancode #cpp #python
To view or add a comment, sign in
-
-
#Duck_Typing A traditional idea says: “The king’s son will become the next king.” A more modern interpretation would be: “The one who is capable will become the king.” This transition from identity-based selection to capability-based evaluation loosely resembles Python’s duck typing. In duck typing, an object’s suitability is determined not by its type, but by its behavior. If an object implements the required methods, it can be used — regardless of its class hierarchy. However, it is important to avoid overextending this analogy. Duck typing does not imply merit-based selection or optimization. It simply enables flexibility by accepting any object that satisfies the expected interface. This distinction is critical. #Python #SoftwareEngineering #Programming #Coding #TechConcepts #CleanCode #SoftwareDesign #LearnToCode #DeveloperMindset #TechLearning
To view or add a comment, sign in
-
More from this author
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