Python solved programs with Output and Explanation

This section contains solved programs in Python with Logic to implement, output and expiations.

List of Python solved programs

Python basic programs

  1. How to print spaces in Python?
  2. Python | Printing different messages by using different variations of print() method.
  3. Python program to print given text using a user-defined method
  4. Python | Printing different values (integer, float, string, Boolean).
  5. Python | Declare different types of variables, print their values, types and Ids.
  6. Python program to demonstrate variables scope
  7. Determine the type of an object in Python
  8. Create number variables (int, float and complex) and print their types and values in Python
  9. Create integer variable by assigning binary value in Python
  10. Create integer variable by assigning octal value in Python
  11. Create integer variable by assigning hexadecimal value in Python
  12. Python | Typecasting Input to Integer, Float.
  13. How to check multiple variables against a value in Python?
  14. Python | Program to define an integer value and print it.
  15. Python | Input two integers and find their addition.
  16. Python program to find sum of two numbers
  17. Python program to find addition of two numbers (4 different ways)
  18. Python program to print ASCII value of a character
  19. Python program for simple interest
  20. Python program for compound interest
  21. Python program to check the given year is a leap year or not
  22. Simple pattern printing programs in Python
  23. Create a function to check EVEN or ODD in Python
  24. Create a function to return the absolute the given value in Python
  25. Python program to check whether a given number is a Fibonacci number or not
  26. Python program to find power of a number using exponential operator
  27. Python program to find the power of a number using loop
  28. Python program to find the power of a number using recursion
  29. Python program to extract and print digits in reverse order of a number
  30. Python program to reverse a given number (2 different ways)
  31. Python program to find floor division
  32. Python | Some of the examples of simple if else.
  33. Python | Input age and check eligibility for voting.
  34. Python | Find largest of three number using nested if else.
  35. Python | Calculate discount based on the sale amount.
  36. Python | Calculate discount based on the sale amount using Nested if else.
  37. Python | Example of Ternary Operator
  38. Python | Design a simple calculator using if elif (just like switch case)
  39. Python | Demonstrate an example of for loop
  40. Python | Demonstrate an example of for each loop
  41. Python | Examples of loops (based on their control)
  42. Python | Some of the Examples of loops
  43. Python | Demonstrate an Example of break statement
  44. Python | Demonstrate an Example of continue statement
  45. Python | Demonstrate an Example of pass statement
  46. Python | Program to print numbers from N to 1 (use range() with reverse order).
  47. Python | Print all numbers between 1 to 1000 which are divisible by 7 and must not be divisible by 5.
  48. Python | Calculate square of a given number (3 different ways).
  49. Python | Find factorial of a given number (2 different ways).
  50. Python | Find the factorial of a number using recursion
  51. Python | Write functions to find square and cube of a given number.
  52. Python | Declare any variable without assigning any value.
  53. Python | BMI (Body Mass Index) calculator.
  54. Python | Program to print Odd and Even numbers from the list of integers.
  55. Python | Program to print Palindrome numbers from the given list.
  56. Python | Compute the net amount of a bank account based on the transactions.
  57. Python | Count total number of bits in a number.
  58. Python | Generate random number using numpy library.
  59. Generate random integers between 0 and 9 in Python
  60. Python | Program to calculate n-th term of a Fibonacci Series
  61. Python program to check prime number
  62. Python program to calculate prime numbers (using different algorithms) upto n
  63. Python program for not None test
  64. Python program for pass statement
  65. Python program to define an empty function using pass statement
  66. Python program for Zip, Zap and Zoom game
  67. Python program to convert temperature from Celsius to Fahrenheit and vice-versa
  68. Python program to find the number of required bits to represent a number in O(1) complexity
  69. Python program to count number of trailing zeros in Factorial of number N
  70. Python program for swapping the value of two integers
  71. Python program for swapping the value of two integers without third variable
  72. Python program to find winner of the day
  73. Python program for Tower of Hanoi
  74. Python program to find standard deviation
  75. Python program to find the variance
  76. Python program Tower of Hanoi (modified)
  77. Python program to convert Centimeter to Inches
  78. Python program to convert meters into yards
  79. Python program to convert yards into meters
  80. Python program to capitalize the character without using a function
  81. Python program to lowercase the character without using a function
  82. Python program to find perfect number
  83. Python program to print perfect numbers from the given list of integers
  84. Python program to design a dice throw function
  85. Python program to design a biased dice throw function
  86. Python program to design a biased coin flip function
  87. Python program to design a coin flip function
  88. Python program to find greatest integer using floor() method
  89. Python program to find the maximum EVEN number
  90. Python program to find the maximum ODD number
  91. Python program to find the solution of a special sum series
  92. Python | Convert the binary number to decimal without using library function
  93. Python | Convert the decimal number to binary without using library function
  94. Create a stopwatch using Python
  95. Python program to find the maximum multiple from given N numbers
  96. Python program to find the least multiple from given N numbers
  97. Find the root of the quadratic equation in Python
  98. Python program to check the given Date is valid or not
  99. Python program to print the calendar of any year
  100. Find all Prime numbers less than or equal to N using the Sieve of Eratosthenes algorithm in Python
  101. Find the sum of all prime numbers in Python
  102. Print the all uppercase and lowercase alphabets in Python
  103. Find the N-th number which is both square and a cube of a number in Python
  104. Program to find the execution time of a program in Python
  105. Program to find the x-intercept and y-intercept of a line passing through the given point in Python
  106. Find the day of the week for a given date in the past or future in Python
  107. Python program to find the GCD of the array
  108. Python program to find the LCM of the array elements
  109. Find the number of integers from 1 to n which contains digits 0's in Python
  110. Check whether a number is a power of another number or not in Python
  111. Check whether the binary representation of a given number is a palindrome or not in Python
  112. Draw a pie chart that shows our daily activity in Python
  113. Find the sum of all numbers below 1000 which are multiples of 3 or 5 in Python
  114. Python | How can I force division to be floating point? Division keeps rounding down to 0?
  115. Python program to print the list of all keywords
  116. Python program to print the version information
  117. Python program to find sum of all digits of a number
  118. Print number with commas as thousands separators in Python

Python Date & Time Programs

  1. Python program to get current date
  2. Python program to get current time
  3. Python program to print today's year, month and day
  4. Python program to print current hour, minute, second and microsecond
  5. Python program to print all timezones using pytz module

Python array programs

  1. Python program to find the sum of all elements of an array
  2. Python program to find a series in an array consisting of characters
  3. Python program to find the occurrence of a particular number in an array
  4. Find the union and intersection of two arrays in Python
  5. Python program to create matrix in Python
  6. Python program to create matrix using numpy
  7. Python program for matrix operations

Python programs on int class

  1. Python program to find number of bits necessary to represent an integer in binary
  2. Python program to print number of bits to store an integer and also print number in Binary format
  3. Python program to print an array of bytes representing an integer
  4. Python program to print the binary value of the numbers from 1 to N

Stack

  1. Python program to reverse a string using stack and reversed method

Lists

  1. Python | Program to declare and print a list.
  2. Python program to print list elements in different ways.
  3. Python | Program for Adding, removing elements in the list.
  4. Python | Program to print a list using ‘FOR and IN’ loop.
  5. Python | Program to add an element at specified index in a list.
  6. Python | Program to remove first occurrence of a given element in the list.
  7. Python | Remove all occurrences a given element from the list.
  8. Python | Program to remove all elements in a range from the List.
  9. Python | Program to sort the elements of given list in Ascending and Descending Order.
  10. Python | Program to find the differences of two lists.
  11. Python | Program to Print the index of first matched element of a list.
  12. Python | Program to find the position of minimum and maximum elements of a list.
  13. Python | Program to input, append and print the list elements.
  14. Python | Program to remove duplicate elements from the list.
  15. Python | Program to Create two lists with EVEN numbers and ODD numbers from a list.
  16. Python | Program to print all numbers which are divisible by M and N in the List.
  17. Python | Create a list from the specified start to end index of another list.
  18. Python | Create three lists of numbers, their squares and cubes.
  19. Python | Create two lists with first half and second half elements of a list.
  20. Python | Iterate a list in reverse order.
  21. Python | print list after removing EVEN numbers.
  22. Python | print list after removing ODD numbers.
  23. Python | Input comma separated elements, convert into list and print.
  24. Python | Convert a string to integers list.
  25. Using List as Stack in Python.
  26. Python | Extend a list using + Operator.
  27. Python program to find N largest and smallest elements from the list
  28. Python program for various list operations
  29. Find the index of an item given a list containing it in Python
  30. Extract Even and odd number from a given list in Python
  31. Remove falsy values from a list in Python
  32. Python program to remove multiple elements from a list using list comprehension

Python string programs

  1. Python | Declare, assign and print the string (Different ways).
  2. Python | Access and print characters from the string.
  3. Python program to print a string, extract characters from the string.
  4. Python | Program to print words with their length of a string.
  5. Python | Print EVEN length words.
  6. Python | Count vowels in a string.
  7. Python | Passing string value to the function.
  8. Python | Create multiple copies of a string by using multiplication operator.
  9. Python | Appending text at the end of the string using += Operator.
  10. Python | Concatenate two strings and assign in another string by using + operator.
  11. Python | Check if a substring presents in a string using 'in' operator
  12. Python | Assign Hexadecimal values in the string and print it in the string format
  13. Python | How to print double quotes with the string variable?
  14. Python | Ignoring escape sequences in the string
  15. Python program to calculate the number of all possible substrings of a string
  16. Python program to reverse a given string (5 different ways)
  17. Python program to reverse a string using stack and reversed method
  18. Split a string into array of characters in Python
  19. Python program for slicing a string
  20. Python program to repeat M characters of a string N times
  21. Python program to swap characters of a given string
  22. Python program to remove a character from a specified index in a string
  23. Python program for adding given string with a fixed message
  24. Find all permutations of a given string in Python
  25. Python | Write a function to find sum of two integral numbers in string format.
  26. Python program to check whether a string contains a number or not
  27. Python program to find the matched characters in a given string
  28. Python | Find the frequency of each character in a string
  29. Extract the mobile number from the given string in Python
  30. Replace a special string from a given paragraph with another string in Python
  31. Find the ASCII value of each character of the string in Python
  32. Print the reverse of a string that contains digits in Python
  33. Check all elements of a list are the same or not in Python
  34. Check all elements are unique or not in Python
  35. Convert a String to camelCase in Python
  36. Capitalizes the first letter of each word in a string in Python
  37. Python program to check if a string is palindrome or not
  38. Python program to input a string and find total number uppercase and lowercase letters
  39. Python program to input a string and find total number of letters and digits
  40. Python program to convert a list of characters into a string
  41. Python program to check whether a variable is a string or not
  42. Python program to count occurrence of a word in the given text

Python dictionary programs

  1. Python | Generate dictionary of numbers and their squares (i, i*i) from 1 to N

Python Class and Object programs

  1. Python example to define a class
  2. Python | Demonstrate an example of Class and Object
  3. Python | Simple program of a class (Input and print a number)
  4. Public variables in Python
  5. Python | Create Employee class with some attributes and methods
  6. Python program to calculate student grade
  7. Python | Example to implement destructor and constructors using __del__() and __init__()
  8. Python | Example to implement Getters and Setters in a class
  9. Python | Implementing setters and getters with the help of properties
  10. Python | Implement Abstraction using Abstract class
  11. Python | Implement Interface using class
  12. Python | Create Employee Class
  13. Python | Create Employee Class with Constructor and Destructor
  14. Example of single inheritance in Python
  15. Example of inheritance with two child (derived) classes in Python
  16. Example of multiple inheritance in Python
  17. Example of multilevel inheritance in Python
  18. Example of hierarchical inheritance in Python
  19. Python program to check prime number using object oriented approach
  20. Python program to count number of objects created
  21. Python program to check Armstrong number using object oriented approach
  22. Python program to check Palindrome number using object oriented approach
  23. Student height record program for a school in Python
  24. Building Restaurant Menu using Class in Python
  25. Program for students marks list using class in Python
  26. Program to manage a phone store (mobile shop) record using class in Python
  27. Program to build flashcard using class in Python

Python Regex programs

  1. Python Regex | program to Remove leading zeros from an IP address

Searching programs

  1. Python program for Binary Search

Python game programs

  1. Python program for rolling the dice (2-player dice game)
  2. Snakes and ladder (Single player) in Python

File handling programs

  1. Copy odd lines of one file to another file in Python
  2. Setting file offsets in Python

Misc.

  1. Design Traditional and Magic Calculator in Python3
  2. Python | Create a line plot using matplotlib.pyplot
  3. Python | Create a bar chart using matplotlib.pyplot
  4. Python | Create a bar graph with using matplotlib.pyplot
  5. Python | Create a stacked bar using matplotlib.pyplot
  6. Python | Create a scatter plot using matplotlib.pyplot
  7. Python | Create pie-chat using matplotlib.pyplot
  8. Python | Create stack plot using matplotlib.pyplot
  9. Python program for plotting in same and different graph
  10. Histogram using Pylab in Python
  11. Python program for single dice simulation
  12. Python program for single biased dice simulation
  13. Python program for biased coin flipping simulation
  14. Python program for double biased dice simulation
  15. Python program for double dice (one biased one normal) simulation
  16. Python program to generate the QR code in Python
  17. Greedy algorithm for a knapsack problem with the example of Robbery in Python
  18. Corona Virus Live Updates for India (District Wise) – Using Python
  19. English dictionary application using Python
  20. Emotional and Sentiment Analysis with the help of Python
  21. Control Mouse in Python
  22. Edge Detection of Image using OpenCV (CV2) in Python
  23. Cropping an Image using OpenCV in Python





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.