Skip to content

ankithkumar08/120-days-of-python-coding-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 

Repository files navigation

120 Days of Python Coding Challenge 🎉🐍

Welcome to my 120 Days of Python Coding Challenge repository! 🚀 This journey is all about immersing myself in Python, tackling challenges, and building my skills every day.

Overview

This repository serves as my daily log of progress in Python programming. Over the next 120 days, I’ll be tackling coding challenges, learning new concepts, and building projects. My goal is to establish a solid foundation in Python and dive into data engineering principles along the way.

🌟 What to Expect

Introduction

The 120 Days of Python Coding Challenge is an exciting initiative aimed at enhancing my programming skills and deepening my understanding of Python. This structured challenge encourages consistent practice and exploration of diverse Python concepts, from foundational programming techniques to more advanced topics. Over the next 120 days, I will tackle a variety of coding problems, engage in hands-on projects, and document my progress as I strive to become a proficient Python developer.

Daily Progress

I will document my daily progress in this repository. Each day's folder will include the coding challenges I worked on, my solutions, and key takeaways. This will help me track my learning journey and reflect on my growth throughout the 120 days.

Daily Questions

In this section, I will outline the coding challenges I encounter each day, including my solutions and the reasoning behind them. This will provide a clear record of my learning experiences and help me measure my progress over time.

Day 1:

  • Question: Write a program to print a statement.
  • Solution: Simple print statement in Python. Code
  • Learnings: Basic syntax and output.

Day 2:

  • Question: Write a program to assign a value to a variable.
  • Solution: Variable assignment in Python.Code
  • Learnings: Understanding variables and data types.

Day 3:

  • Question: Write a program to add two numbers.

  • Solution: Addition using user input.Code

  • Learnings: Input handling and arithmetic operations.

  • Question: Write a program to find the square root.

  • Solution: Square root calculation using **.Code

  • Learnings: Mathematical operations and functions.

Day 4:

  • Question: Write a Python program to check if a number is odd or even.

  • Solution: Checking if a number is divisible by 2 to determine if it is odd or even..Code

  • Learnings: Conditional statements (if-else) and modulus operator %

  • Question: Write a Python program to check if a number is positive, negative, or zero.

  • Solution: Using conditional statements to check the sign of a number.Code

  • Learnings: Multiple conditions with elif and handling input.

Day 5:

  • Question: Write a Python program to check if a year is a leap year.

  • Solution: Checking divisibility by 4, 100, and 400 using a function to determine if a year is a leap year.Code

  • Learnings: Understanding logical operators and modular arithmetic in Python.

  • Question: Write a Python program to find the largest among three numbers.

  • Solution: Using conditional statements to compare three numbers and find the largest.Code

  • Learnings: Handling multiple conditions with if-elif-else and user input for numerical comparisons.

Day 6:

  • Question: Write a program to check if a number is prime using functions.
  • Solution: Prime number check using a function. Code
  • Learnings: Explored function definitions, conditionals, and loop structures for checking prime numbers and how to use flag variables to manage logic and control flow in loops.

Day 7:

  • Question: Write a program to find the factorial of a number using loops.
  • Solution: Factorial calculation using a for loop. Code
  • Learnings: Practiced looping constructs and conditional checks to calculate the factorial of a number.

Day 8:

  • Question: Write a program to print the Fibonacci sequence up to the n-th term.
  • Solution: Fibonacci sequence generation using a while loop. Code
  • Learnings: Practiced working with loops and sequence generation. Learned about the Fibonacci series and how to calculate it iteratively.

Day 9:

  • Question: Write a program to check if a number is an Armstrong number.
  • Solution: Armstrong number check using functions and loops. Code
  • Learnings: Practiced using loops and functions to check for Armstrong numbers and understood the concept behind it.

Day 10:

  • Question: Write a program to check if a number is an Armstrong number.
  • Solution: Armstrong number check using functions and loops. Code
  • Learnings: Practiced using loops and functions to check for Armstrong numbers and understood the concept behind it.

Day 11:

  • Question: Write a program to calculate the sum of natural numbers up to a user-defined value.
  • Solution: Practiced using loops to sum natural numbers based on user input. Code
  • Learnings: Gained insight into user input management and iterative summation techniques.

Day 12:

  • Question: Write a Python program to display powers of a number using an anonymous function (lambda).
  • Solution: Used a lambda function with map() to calculate powers of a base number up to a specified number of terms. Code
  • Learnings: Practiced efficient use of lambda and map() for streamlined calculations in Python.

Day 13:

  • Question: Write a Python program to find numbers divisible by another number.
  • Solution: Used both enumerate with for loop and lambda functions for filtering divisibility. Code
  • Learnings: Practiced using lambda functions and enumerate for efficient coding.

Day 14:

  • Question: Write a Python program to convert a decimal number to binary.
  • Solution: Write a Python program to convert a decimal number to binary. Code
  • Learnings: Practiced recursion and explored Python’s built-in bin() function for efficient and readable code.

Day 15:

  • Question: Write a Python program to find the factors of a given number.
  • Solution: A program that displays all factors of a user-defined number. Code
  • Learnings: Practiced loops and conditionals, enhancing my understanding of efficient iteration in Python.

Day 16:

  • Question: Write a Python program to perform basic calculator operations.
  • Solution: Built a calculator to add, subtract, multiply, or divide numbers. Code
  • Learnings: Practiced conditionals, loops, and input validation.

Day 17:

  • Question: Write a Python program to display the month of a given year.
  • Solution: Created a program using the calendar module to show a specific month for a given year. Code
  • Learnings: Gained experience with modules and user input handling.

Day 18:

  • Question: Write a Python program to add two matrices.
  • Solution: Used nested loops to add corresponding elements of two matrices. Code
  • Learnings: Gained practice in matrix addition and handling nested loops.

Day 19:

  • Question: Write a Python program Find the ASCII value of a given character.
  • Solution: Developed a program to input a character and display its ASCII value using the ord() function. Code
  • Learnings: Enhanced skills in user input handling and character encoding concepts.

Day 20:

  • Question: Write a Python program to transpose a matrix.
  • Solution: Used nested loops to swap rows and columns, creating the transposed matrix. Code
  • Learnings: Enhanced understanding of nested loops and matrix transformations.

Day 21:

  • Question: Write a Python program to product of two matrices.
  • Solution: Used nested loops to calculate the product of two matrices by iterating over rows and columns. Code
  • Learnings: Strengthened knowledge of nested loops and matrix operations.

Day 22:

  • Question: Write a Python program to find the HCF of two numbers.
  • Solution: Used loops to calculate the HCF by checking divisibility up to the smaller number. Code
  • Learnings: Enhanced understanding of loops and conditionals.

Day 23:

  • Question: Write a Python program to check whether a string is a Palindrome.
  • Solution: Used Python string methods to reverse the string and check if it matches the original, ignoring case. Code
  • Learnings: Strengthened my skills in string manipulation and explored different methods for reversing a string in Python.

Day 24:

  • Question: Write a Python program to check whether a string is a Palindrome.
  • Solution: Used a predefined set of punctuation characters and iterated through the input string, constructing a new string without punctuation. Code
  • Learnings: Strengthened my skills in string manipulation and explored different methods for reversing a string in Python.

Day 25:

  • Question: Write a Python program to remove punctuations from a given string.
  • Solution: Used Python string methods to reverse the string and check if it matches the original, ignoring case. Code
  • Learnings: Improved my understanding of string manipulation and filtering techniques in Python. Explored how to efficiently remove unwanted characters using loops.

Day 26:

  • Question: Write a Python program to sort words in a string in alphabetical order.
  • Solution: Used Python's split() method to break the string into words, converted them to lowercase for uniformity, and then sorted them using the sort() method. Code
  • Learnings: Strengthened my understanding of string manipulation and list operations. Explored how sorting works in Python and how case sensitivity affects sorting results.

Day 27:

  • Question: Write a Python program to count the number of vowels in a given string.
  • Solution: Used a dictionary to store vowel counts, converted the string to lowercase using casefold(), and iterated through each character to update the count. Code
  • Learnings: Enhanced my knowledge of dictionaries in Python and how they can be used for counting occurrences. Explored the importance of case handling in string operations.

Day 28:

  • Question: Write a Python program to print different star patterns based on user input.
  • Solution: Implemented three different patterns using loops: a right-angled triangle, a pyramid, and an inverted pyramid. Used nested loops and string multiplication for efficient pattern generation. Code
  • Learnings: Strengthened my understanding of nested loops and string manipulation for pattern printing. Explored how spaces and asterisks can be dynamically adjusted to create symmetrical designs.

Day 29:

  • Question: Write a Python program to demonstrate different types of list slicing operations.
  • Solution: Used Python’s slicing syntax to extract various sublists, including full list slicing, slicing from a specific index, slicing with step values, and reverse slicing. Code
  • Learnings: Improved my understanding of list slicing techniques and how step values work in Python. Explored how negative step values can be used to reverse a list or skip elements efficiently.

Day 30:

  • Question: Write a Python program to check if a list is empty.
  • Solution: Implemented multiple ways to check if a list is empty, including checking its length using len(), using a direct comparison with an empty list [], and leveraging Python's truthy/falsy nature of empty lists. Code
  • Learnings: Explored different approaches to check for empty lists in Python. Learned that an empty list evaluates to False in a boolean context, making if not my_list: a more Pythonic way to check for emptiness.

Day 31:

  • Question: Write a Python program to merge two lists
  • Solution: Explored three different ways to concatenate lists: using the + operator, unpacking with *, and using the extend() method to modify a list in place. Code
  • Learnings: Learned various techniques for merging lists efficiently. Understood the difference between creating a new list (+ and * unpacking) versus modifying an existing list (extend()).

Day 32:

  • Question: Write a Python program to iterate through a list with index and value.
  • Solution: Used two different approaches to iterate through a list while keeping track of both the index and the value: one using enumerate() and the other using a for loop with range(len(my_list)). Code
  • **Learnings:**Learned the advantages of using enumerate(), which provides a cleaner and more Pythonic way to iterate through a list with indices. Also reinforced the traditional range(len()) approach for cases where direct index manipulation is needed.

Day 33:

  • Question: Write a Python program to merge two dictionaries
  • Solution: Explored three different ways to merge dictionaries: using the | operator (Python 3.9+), dictionary unpacking with **, and the update() method to modify a dictionary in place. Code
  • Learnings: Learned multiple techniques for combining dictionaries and how they handle key conflicts (values from the second dictionary override those in the first). Understood the difference between creating a new dictionary (| and ** unpacking) and modifying an existing one (update()).

Day 34:

  • Question: Write a Python program to perform set operations like union, intersection, difference, and symmetric difference.
  • Solution: Used Python's set operators to compute various set operations: | for union, & for intersection, - for difference, and ^ for symmetric difference. Code
  • Learnings: Strengthened my understanding of set operations in Python. Learned how sets efficiently handle unique elements and how different operations can be used for filtering and combining data.

Day 35:

  • Question: Write a Python program to sort a dictionary by its values.
  • Solution: Used sorted() to first extract and sort dictionary values separately, then applied dictionary comprehension with sorted(dt.items(), key=lambda item: item[1]) to sort the dictionary by values. Code
  • Learnings: Learned how to sort dictionaries based on values rather than keys. Explored the use of lambda functions within the sorted() method and how dictionary comprehension helps in creating a sorted dictionary efficiently.

Day 36:

  • Question: Write a Python program to check if a key exists in a dictionary.
  • Solution: Used the in operator to check whether a specific key is present in the dictionary and printed the result accordingly. Code
  • Learnings: Learned that checking for a key in a dictionary using in is an efficient and Pythonic approach. Explored how dictionaries offer fast lookups compared to lists due to their underlying hash table structure.

Day 37:

  • Question: Write a Python program to remove duplicates from a list and find unique elements between two lists.
  • Solution: Used set() to remove duplicates from a list and the symmetric difference operator ^ to find unique elements between two lists. Code
  • Learnings: Explored how sets automatically remove duplicates and provide efficient operations for comparing lists. Learned that the symmetric difference ^ returns elements that are in either of the two sets but not in both.

Technologies Used

  • Programming Language: Python
  • Tools: Git, GitHub, Visual Studio Code, IDLE

Connect with Me

Find out more about my journey and connect with me on LinkedIn.


Thank you for checking out my repository! Let’s code together! 💻

About

python coding

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages