Day 17 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to count the number of vowels and consonants in a given string. The goal was to practice string traversal and character classification. What the program does: • Takes a string input from the user • Converts the string to lowercase for consistency • Checks each character individually • Counts vowels and consonants separately • Returns both counts How the logic works: A function count_vowels_consonants(string) is defined Two strings are created: – One containing all vowels (aeiou) – One containing all consonants Two counters are initialized to 0 The program loops through each character in the string If the character is in the vowel string, vowel count increases If the character is in the consonant string, consonant count increases The function returns both counts Example: Input: my name is SATISH KUMAR Output: Vowels: 7 Consonants: 12 Key learnings from Day 17: – Iterating through strings – Using conditional statements effectively – Handling case sensitivity with .lower() – Strengthening basic string manipulation skills #100DaysOfCode #Day17 #Python #PythonProgramming #StringManipulation #ProblemSolving #CodingPractice #LogicBuilding #LearnByDoing #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney
Python Vowel Consonant Counter Program
More Relevant Posts
-
🚀 Day 3 of Learning Python Today was all about writing smarter and more efficient code: ✅ `filter()` function ✅ `lambda` functions ✅ `return` statement The `filter()` function helped me understand how to extract specific data from a list based on conditions. With `lambda` functions, I learned how to write short, one-line functions — super useful for quick operations without defining full functions. And the `return` statement showed me how functions give back results, making them reusable and powerful. Each concept is small on its own, but together they really change how you think about problem-solving in code. Staying consistent and building every day 💪 #Python #CodingJourney #LearningJourney#30DaysOfCode #TechSkills #Deeper Learning # Leet code
To view or add a comment, sign in
-
Day 10 of my Python journey Missed the class, but caught up stronger Today’s focus: Lists & Real-world Logic ✔ Built a mini time converter (24hr → 12hr format) ✔ Understood list basics & nested indexing ✔ Explored list methods (append, extend, remove, pop) ✔ Learned the power of mutable data structures Big takeaway: Lists are not just storage — they’re powerful tools for solving real problems. Code link : https://lnkd.in/gTjGZd5X Consistency continues 🚀 #Python #100DaysOfCode #CodingJourney #FullStackDeveloper Codegnan Saketh Kallepu
To view or add a comment, sign in
-
🚀 Day 3 of Learning Python Today was all about writing smarter and more efficient code: ✅ `filter()` function ✅ `lambda` functions ✅ `return` statement The `filter()` function helped me understand how to extract specific data from a list based on conditions. With `lambda` functions, I learned how to write short, one-line functions — super useful for quick operations without defining full functions. And the `return` statement showed me how functions give back results, making them reusable and powerful. Each concept is small on its own, but together they really change how you think about problem-solving in code. Staying consistent and building every day 💪 #Python #CodingJourney #LearningInPublic #100DaysOfCode #TechSkills #StudentDeveloper
To view or add a comment, sign in
-
🚀 30 𝐃𝐚𝐲𝐬 𝐨𝐟 𝐏𝐲𝐭𝐡𝐨𝐧 — 𝐃𝐚𝐲 #16 | 𝐋𝐢𝐬𝐭 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐬 & 𝐌𝐞𝐭𝐡𝐨𝐝𝐬 Day 16 was focused on exploring list functions and methods that make working with lists more efficient and powerful. After understanding the basics of lists, I learned today that Python provides built-in methods to easily modify, manage, and analyze list data. 📌 𝐖𝐡𝐚𝐭 𝐈 𝐂𝐨𝐯𝐞𝐫𝐞𝐝: 🔹 Adding elements using 𝐚𝐩𝐩𝐞𝐧𝐝() and 𝐢𝐧𝐬𝐞𝐫𝐭() 🔹 Removing elements with 𝐫𝐞𝐦𝐨𝐯𝐞() and 𝐩𝐨𝐩() 🔹 Sorting lists using 𝐬𝐨𝐫𝐭() 🔹 Reversing lists with 𝐫𝐞𝐯𝐞𝐫𝐬𝐞() 🔹 Counting occurrences using 𝐜𝐨𝐮𝐧𝐭() 🔹 Finding element positions with 𝐢𝐧𝐝𝐞𝐱() Learning these methods made it clear how Python simplifies operations on data collections. 💡 𝐊𝐞𝐲 𝐓𝐚𝐤𝐞𝐚𝐰𝐚𝐲: Built-in list methods save time and make code cleaner by handling common operations efficiently. Day 16 complete ✅ Each new concept is making Python feel more powerful and intuitive. 💻✨ #Python #30DayChallenge #Day16 #PythonLists #ListMethods #CodingJourney #LearnToCode #Programming #TechGrowth #Consistency
To view or add a comment, sign in
-
-
Day 4/100: Randomness and Data Structures in Python! Today was an exciting day! I shifted from simple variables to Lists, which allowed me to manage collections of data efficiently. I also explored how to make programs unpredictable using the Random module. What I mastered today: The random Module: Generating random integers and floats to create dynamic experiences. Python Lists: Learning how to store, access, and organize data. List Methods: Mastering .append() to add items and .extend() to combine lists. Offset & Indexing: Accessing specific items (and avoiding the famous "Index Out of Range" error!). Daily Project: Rock Paper Scissors Game I built a fully functional Rock Paper Scissors game where the user plays against the computer. It was a great way to combine if-else logic with random.randint(). Check out my code and progress here: https://lnkd.in/eYp3jYs7 #Python #100DaysOfCode #DataStructures #CodingJourney #RockPaperScissors #Programming
To view or add a comment, sign in
-
-
Day 29 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the maximum occurring character in a string. The goal was to count the frequency of each character and determine which one appears the most. What the program does: • Takes a string as input • Counts the frequency of each character using a dictionary • Tracks the character with the highest occurrence • Handles edge cases like an empty string • Returns the most frequent character How the logic works: 1)A dictionary char_counts is used to store character frequencies 2)The program iterates through each character in the string 3)For every character, its count is updated using .get(char, 0) + 1 4)After counting, another loop checks which character has the highest frequency 5)The character with the maximum count is stored and returned 6)If the string is empty, the function returns None Example: Input: "hello world" Output: Maximum occurring character → l Input: "program" Output: Maximum occurring character → r Why this approach works well: – Uses dictionary for fast lookups – Time Complexity: O(n) – Efficient way to track frequencies Key learnings from Day 29: – Using dictionaries for frequency counting – Iterating through strings efficiently – Handling edge cases in programs – Strengthening string manipulation logic #100DaysOfCode #Day29 #Python #PythonProgramming #StringManipulation #Algorithms #ProblemSolving #CodingPractice #DataStructures #InterviewPrep #LearnByDoing #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
Day 32 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to implement a custom version of the isdigit() function. Instead of using Python’s built-in method, I created my own function to check whether a string contains only numeric digits. What the program does: • Takes a string as input • Checks each character in the string • Verifies whether it lies between '0' and '9' • Returns True if all characters are digits • Returns False otherwise How the logic works: 1)The function first checks if the string is empty 2)If it is empty, it returns False 3)The program iterates through each character in the string 4)It checks whether the character falls within the range '0' to '9' 5)If any character fails this condition, the function returns False 6)If all characters satisfy the condition, the function returns True Example: Input: "123" Output: True Input: "123a" Output: False Input: "-1" Output: False Input: "0" Output: True Why this is useful: – Helps understand how built-in functions work internally – Uses ASCII character comparison – Strengthens string validation logic Key learnings from Day 32: – Implementing built-in functionality manually – Understanding ASCII-based comparisons – Writing validation logic for strings – Strengthening Python fundamentals #100DaysOfCode #Day32 #Python #PythonProgramming #StringValidation #Algorithms #ProblemSolving #CodingPractice #LearnByDoing #ComputerScience #ProgrammingJourney #DeveloperGrowth #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
🚀 Day 52 of My Python & DSA Journey Today I revisited Complement of Base 10 Integer on LeetCode — but this time with a more optimized bit manipulation approach! 🔍 Problem Overview: Find the complement of a number by flipping all bits in its binary form. 🧠 Optimized Approach: Instead of converting to binary string, I used bitwise operations: • Create a mask with all bits set to 1 (same length as the number) • Use XOR (^) to flip the bits directly • Special case: when n = 0, return 1 👉 Formula used: (mask - 1) ^ n ⚡ Why this is better: • Avoids string conversion • Works directly on bits (more efficient) • Cleaner and more optimal solution 📊 Complexity: • Time Complexity: O(log n) • Space Complexity: O(1) 💡 Key Learnings: • Deepened understanding of bitwise operators • Learned how to build bit masks dynamically • Understood difference between basic vs optimized solutions Under the Guidance of : Rudra Sravan kumar and Manoj Kumar Reddy Parlapalli #Day52 #Python #LeetCode #BitManipulation #DataStructures #Algorithms #CodingJourney #100DaysOfCode 🚀
To view or add a comment, sign in
-
-
Day 26 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the intersection of two arrays (lists). The goal was to identify the elements that appear in both arrays using Python’s set operations. What the program does: • Takes two lists as input • Converts the lists into sets • Finds the common elements between them • Demonstrates two ways to compute intersection • Prints the intersection result How the logic works: 1)Two lists (arr1 and arr2) are defined 2)Both lists are converted into sets using set() 3)Intersection is calculated using the .intersection() method 4)The same result is also computed using the & operator 5)The resulting set is converted back into a list and printed Example: Input: Array 1:[1, 2, 3, 4, 5] Array 2:[4, 5, 6, 7, 8] Output: Intersection:[4, 5] Why using sets is powerful: – Removes duplicate values automatically – Faster lookup operations – Time Complexity around O(n) Key learnings from Day 26: – Understanding set operations in Python – Using .intersection() vs & operator – Writing efficient list comparison logic – Strengthening data structure knowledge #100DaysOfCode #Day26 #Python #PythonProgramming #SetOperations #DataStructures #Algorithms #ProblemSolving #CodingPractice #LearnByDoing #ComputerScience #InterviewPrep #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
#Day 47 of My Python & DSA Journey Today I solved the “Check if Binary String Has at Most One Segment of Ones” problem on LeetCode. 🔍 Problem Overview: Given a binary string containing only 0s and 1s, the task is to determine whether the string contains at most one continuous segment of 1s. If multiple separated segments of 1s exist, the result should be False. 🧠 Approach: I iterated through the string and tracked how many times a new segment of 1s starts. Whenever a 1 appears either at the beginning of the string or immediately after a 0, it indicates the start of a new segment. If more than one such segment is found, the condition fails. ⚡ Key Takeaways: • Strengthened understanding of string traversal • Practiced pattern recognition in binary strings • Improved logical problem-solving using Python 📊 Complexity: • Time Complexity: O(n) • Space Complexity: O(1) Consistently solving problems helps me improve my algorithmic thinking and coding efficiency every day. Looking forward to learning more and solving tougher challenges ahead! Under the Guidance of : Rudra Sravan kumar and Manoj Kumar Reddy Parlapalli #Day47 #Python #LeetCode #DataStructures #Algorithms #CodingJourney #ProblemSolving #100DaysOfCode
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