Day 7/30: Loops, Lists, and Logic: Building Hangman in Python Today, I had to implement a Game Loop (while loop) that keeps the program alive until a specific win/loss condition is met. I used Python's random module and while loops to recreate the tension of the classic paper-and-pencil game in the terminal. Features: ✅ Random word generation from a large database. ✅ ASCII art that updates with every wrong guess. ✅ Input validation to handle repeated guesses. Making progress every single day. 🚀 Link: https://lnkd.in/dJYvzwnj #Python #GameDev #Coding #DailyProgress #TechSkills #istudyatsqi #codewithsteff #datascience
Implementing Hangman in Python with Loops and Logic
More Relevant Posts
-
🚀 Day 12 of #100DaysOfCode – Understanding Scope in Python! Today I continued Angela Yu’s 100 Days of Python course and learned about local and global scope, an important concept for understanding how variables behave inside and outside functions. 🔹 What I learned today: Difference between local and global variables How scope affects variable access and modification 🔹 Simple Example: score = 10 # Global scope def update_score(): score = 5 # Local scope print(score) update_score() print(score) 💡 Project of the Day: Number Guessing Game I built a Number Guessing Game where the player tries to guess a randomly generated number within a limited number of attempts. This project was a great way to apply scope, functions, loops, and conditional logic together. Learning something new every day—on to Day 13! 🚀 #Python #100DaysOfCode #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
LeetCode 191: Number of 1 Bits (also known as finding the Hamming Weight). The Efficiency Secret: While you can solve this using a while loop with bit-shifting or a string conversion, Python’s built-in bit_count() method is implemented directly at the C-level in the interpreter. It provides the most efficient way to count set bits in an integer. The Results: 🎯 Runtime: 0 ms (Beats 100.00%) 🧠 Memory: 17.53 MB (Beats 92.87%) This solve marks a great addition to my recent streak of 100% efficiency beats in both memory and runtime across various string and math problems. Consistency is paying off! #LeetCode #Python #BitManipulation #CleanCode #Optimization #SoftwareEngineering #Consistency
To view or add a comment, sign in
-
-
Day 12 of #30DaysOfCode with Educative 🟦 Challenge: Middle of the Linked List (Easy) Approach: Slow–fast pointer technique Insight: Traverse the list with two pointers: the slow pointer moves one step at a time, and the fast pointer moves two steps. When the fast pointer reaches the end, the slow pointer naturally lands on the middle node; for even-length lists, this lands on the second middle, exactly as required. Tricky Part: The only small care point is the loop condition, checking both fast and next pointer to fast avoids null-pointer issues and cleanly handles both odd and even list lengths. #Educative #Python #SoftwareEngineering #ContinuousLearning #ProblemSolving
To view or add a comment, sign in
-
Day 48 of My #50DaysofPython – Built a Real-Time Digital Clock ⏱️ Today’s task was a simple but practical real-time Python project — a Digital Clock that updates every second. Using the time module, I created a loop that displays live time in HH:MM:SS format and refreshes continuously. This task helped me understand: ✔ How real-time programs work ✔ Using strftime() to format time ✔ Running continuous loops with delays ✔ Text refreshing in the console #Python #LearningJourney #50DaysOfCode
To view or add a comment, sign in
-
Theory is good. Proof is better. 🐢 vs ⚡ We’ve all studied Multithreading in Python. We know the definitions. But have we actually performed the benchmark? I decided to put the theory to the test. wrote two scripts to download high-res images: 1️⃣ Single-Threaded: The standard loop we all write. 2️⃣ Multi-Threaded: Using ThreadPoolExecutor. That is a 60% performance increase just by changing how we handle I/O waiting time. Check out the video to see the race, and grab the code on my GitHub to try it yourself! 👇 https://lnkd.in/gZASrAUj #Python #RealWorldCoding #DataAnalysis #Multithreading #Performance
To view or add a comment, sign in
-
Day 78: Product Except Self This code calculates the product of all elements except the element at the current index in O(n) time, without division! The magic: two passes. First, calculate prefix products (from the left). Second, multiply by postfix products (from the right). Done! #Day78 #Algorithm #Coding #Arrays #InterviewPrep #O_n #Python
To view or add a comment, sign in
-
**Day 90: Permutation in String 🧩** Check if `s2` contains a permutation of `s1` using a **Sliding Window**! Track character counts and a `matches` variable to update the state in O(1) as you slide. No re-sorting needed, just pure O(n) efficiency! ⚡ #Day90 #SlidingWindow #LeetCode #Python #Coding #Algorithm #DSA #100DaysOfCode
To view or add a comment, sign in
-
Today I solved the Longest Common Prefix problem, which focuses on string comparison and edge-case handling. 🔹 Problem: Given an array of strings, find the longest prefix common to all strings. If no common prefix exists, return an empty string. 🔹 Approach: ✔️ Take the first string as a reference ✔️ Compare characters index-by-index with all other strings ✔️ Stop immediately when a mismatch occurs #DSA #Python #ProblemSolving #CodingPractice #LeetCode #LearningJourney #SoftwareEngineering #Consistency
To view or add a comment, sign in
-
-
#Day3 of #100DaysofAI Day 3 was packed with Python control flow mastery and function building! Revised if/elif/else, for/while loops with break/continue, list comprehensions, then wrote 8 practical functions (add/subtract/multiply/divide, even/odd checker, prime tester, reverse number, Fibonacci generator). Built a Simple Calculator and Number Guessing Game as mini-projects. Key takeaway: print() shows output, return computes values — functions must return, never assign print() to variables. Control flow is logic's backbone! #AIJourney #LearningInPublic #Python #ArtificialIntelligence #BuildInPublic
To view or add a comment, sign in
-
String indexing in Python allows accessing characters using their position, e.g., ' 'my_string[0]' gets the first character. Indexing starts at 0, and negative indices count from the end, e.g., 'my_string[-1]' gets the last character. #coding #python #programming #programminglanguage #pythonprogramminglanguag
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