My Notes

Python Problem Statements

Table of content

Section 1: Core Python Logic (Warm-up)


Section 2: Data Types & Mutability


Section 3: Strings & Lists


Section 4: Functions & Recursion


Section 5: OOPS Thinking


Section 6: Exception Handling & Files


Section 7: Python Internals


πŸ”Ή Section 1: Core Python Logic

  • Check whether a number is even or odd
    Try this question –link
  • Check whether a number is positive, negative, or zero
  • Find the largest of three numbers
    Try this question –link
  • Print numbers from 1 to N using loop
    Try this question –link
  • Find sum of first N natural numbers
  • Check whether a year is a leap year
    Try this question –link
  • Print Fibonacci series up to N terms
    Try this question –link

πŸ”Ή Section 2: Data Types & Mutability

  • Explain difference between mutable and immutable
    Try this question –link
  • List manipulation (append)
    Try this question –link
  • Remove duplicates from a list
    Try this question –link
  • Find frequency of elements
    Try this question –link
  • Difference between is and == with example

πŸ”Ή Section 3: Strings & Lists

  • Reverse a string
    Try this question –link
  • Palindrome check
    Try this question –link
  • Count number of vowels and consonants
  • Find duplicate characters
    Try this question –link
  • Remove spaces from a string
  • Find second largest element
    Try this question –link
  • Sort a list without using sort()
  • Find missing number
    Try this question –link

πŸ”Ή Section 4: Functions & Recursion

  • Check prime number
    Try this question –link
  • Factorial (Recursion)
    Try this question –link
  • Difference between return and print
  • Default arguments
    Try this question –link
  • Use *args to calculate sum of numbers
  • Recursive digit sum
    Try this question –link

πŸ”Ή Section 5: OOPS in Python

  • Explain class and object with example
  • Init & Instance Variables
    Try this question –link
  • Difference between instance variable and class variable
  • Inheritance
    Try this question –link
  • What is polymorphism? Give real-life example
  • What is encapsulation?
  • What are dunder methods? Explain __str__

πŸ”Ή Section 6: Exception Handling & Files

  • Difference between syntax error and runtime error
  • Try, Except, Finally
    Try this question –link
  • Multiple Exceptions
    Try this question –link
  • What is raise? Why is it used?
  • Write code to read a file
  • Difference between file modes r, w, a

πŸ”Ή Section 7: Python Internals & Tricky

  • Why are Python strings immutable?
  • List comprehension
    Try this question –link
  • Difference between shallow copy and deep copy
  • id() function
    Try this question –link
  • Why 0.1 + 0.2 != 0.3 in Python?
  • Difference between and vs or return values
  • What happens when function doesn’t return anything?

Mini Project of using Next.js and Tailwind CSS