Day 12 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to convert a decimal number into its binary representation without using built-in functions like bin(). The goal was to understand how number base conversion works internally. What the program does: • Takes a decimal number as input • Uses division and modulo operations • Builds the binary representation manually • Returns the final binary number as a string How the logic works: An empty string binary is initialized to store the result A while loop runs as long as the number is greater than 0 The remainder when dividing by 2 (n % 2) is calculated The remainder is added to the front of the binary string The number is reduced using integer division (n // 2) The loop continues until the number becomes 0 The final binary string is returned Example: Input - 34 Output - Binary representation of 34 is: 100010 Key learnings from Day 12: – Understanding number system conversion – Using modulo and integer division effectively – Building logic step-by-step without built-in shortcuts – Strengthening fundamental programming concepts #100DaysOfCode #Day12 #Python #PythonProgramming #NumberSystems #BinaryConversion #ProblemSolving #CodingPractice #LearnByDoing #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney
100DaysOfCode Day 12: Binary Conversion with Python
More Relevant Posts
-
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
To view or add a comment, sign in
-
-
Day 14 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the common elements between two lists using sets. The goal was to solve the problem efficiently without using nested loops. What the program does: • Takes two lists as input • Converts both lists into sets • Uses set intersection to find common elements • Converts the result back into a list • Prints the common elements How the logic works: Two lists are defined with numeric values Both lists are converted into sets using set() The intersection operator & is used to find common elements The resulting set is converted back into a list The final list of common elements is displayed Example: List 1:[1, 2, 3, 4, 5] List 2:[4, 5, 6, 7, 8] Output: Common elements:[4, 5] Key learnings from Day 14: – Understanding set operations in Python – Using intersection (&) efficiently – Avoiding nested loops for better performance – Writing clean and optimized code #100DaysOfCode #Day14 #Python #PythonProgramming #SetOperations #DataStructures #ProblemSolving #CodingPractice #LearnByDoing #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
Day 16 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to print a diamond pattern using stars (*). The goal was to understand nested loops, pattern logic, and spacing techniques in Python. What the program does: • Takes the number of rows as input • Prints the upper half of the diamond • Prints the lower half of the diamond • Uses spaces and stars to create a symmetric pattern How the logic works: 1)A function print_diamond(n) is defined 2)The first for loop prints the upper part of the diamond – Spaces are printed using ' ' * (n - i - 1) – Stars are printed using '*' * (2 * i + 1) 3)The second for loop prints the lower part – It runs in reverse order – The same spacing and star logic is applied Key learnings from Day 16: – Understanding pattern-based logic – Working with nested loops – Controlling spacing and alignment – Strengthening logical thinking #100DaysOfCode #Day16 #Python #PythonProgramming #PatternProgramming #LogicBuilding #CodingPractice #ProblemSolving #LearnByDoing #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney
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_62 of of learning with Skill Shikshya. Today I learned about loops in Python, a concept that makes coding much more efficient and powerful. Loops allow us to run the same block of code multiple times without writing it again and again, which is especially useful when working with large amounts of data. I explored how for loops can be used to iterate through lists, strings, and other data structures, and how while loops run based on conditions. As I practiced, I also understood how to control the flow of loops using statements like break and continue. This concept made me realize how important automation is in data analysis. Instead of manually repeating tasks, loops help process data faster and more effectively. Step by step, I am building the skills needed to handle real-world datasets with confidence. #100daysoflearning #DataAnalyst #Learningjourney
To view or add a comment, sign in
-
Python Journey — Day 13 | Functions with Numbers, Strings & Lists Today I continued practicing functions in Python by solving different logical problems using reusable function-based solutions. Problems I solved : • Sum of digits of a number • Product of digits • Armstrong number check • Reverse a number • Palindrome number check • Count vowels in a string • Count consonants in a string • Perfect number check • Strong number check • Find largest element in a list • Remove duplicates from a list • Reverse a list • Find second largest element • Count even and odd numbers in a list I implemented these problems using functions along with loops and list and string logic to improve code reusability and structure. Thanks to Rudra Sravan kumar sir for the guidance and continuous support. Learning daily and getting more confident #Python #PythonDeveloper #1000Coders #Coding #LearningJourney #ProblemSolving #CodeEveryDay
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 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 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
-
-
Day 6 of 20 Learning Challenge 🎉🖥 Lists, tuples, and dictionaries are Python's power trio. 🗂️📋 Six days in and I now understand why Python is the world's most popular programming language; it is powerful yet readable. Today I dove deep into Python data structures: lists, tuples, dictionaries, and sets. I learned when to use each one and why it matters. Lists for ordered, mutable data. Tuples for fixed, protected data. Dictionaries for key-value relationships. Sets for unique collections. I built a small contact book program using dictionaries storing names, phone numbers, and emails. Something clicked today. I stopped seeing code as abstract symbols and started seeing it as a blueprint for real-world solutions. 💡 Choose your data structure wisely. The right container makes all the difference. #Python #DataStructures #LearningJourney #WomenInTech #BackendDevelopment #Django #CodeNewbie #Git20DaysChallenge #AfricaAgility #AgitCohort9
To view or add a comment, sign in
-
Explore related topics
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