Home » Python

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. Python | Printing different messages by using different variations of print() method.
  2. Python | Printing different values (integer, float, string, Boolean).
  3. Python | Declare different types of variables, print their values, types and Ids.
  4. Determine the type of an object in Python
  5. Create number variables (int, float and complex) and print their types and values in Python
  6. Create integer variable by assigning binary value in Python
  7. Create integer variable by assigning octal value in Python
  8. Create integer variable by assigning hexadecimal value in Python
  9. Python | Typecasting Input to Integer, Float.
  10. Python | Program to define an integer value and print it.
  11. Python | Input two integers and find their addition.
  12. Python program to find sum of two numbers
  13. Python program to print ASCII value of a character
  14. Python program for simple interest
  15. Python program for compound interest
  16. Python program to check whether a given number is a Fibonacci number or not
  17. Python program to find power of a number using exponential operator
  18. Python program to find the power of a number using loop
  19. Python program to extract and print digits in reverse order of a number
  20. Python program to find floor division
  21. Python | Some of the examples of simple if else.
  22. Python | Input age and check eligibility for voting.
  23. Python | Find largest of three number using nested if else.
  24. Python | Calculate discount based on the sale amount.
  25. Python | Calculate discount based on the sale amount using Nested if else.
  26. Python | Example of Ternary Operator
  27. Python | Design a simple calculator using if elif (just like switch case)
  28. Python | Demonstrate an example of for loop
  29. Python | Demonstrate an example of for each loop
  30. Python | Examples of loops (based on their control)
  31. Python | Some of the Examples of loops
  32. Python | Demonstrate an Example of break statement
  33. Python | Demonstrate an Example of continue statement
  34. Python | Demonstrate an Example of pass statement
  35. Python | Program to print numbers from N to 1 (use range() with reverse order).
  36. Python | Print all numbers between 1 to 1000 which are divisible by 7 and must not be divisible by 5.
  37. Python | Calculate square of a given number (3 different ways).
  38. Python | Find factorial of a given number (2 different ways).
  39. Python | Write functions to find square and cube of a given number.
  40. Python | Declare any variable without assigning any value.
  41. Python | Write a function to find sum of two integral numbers in string format.
  42. Python | BMI (Body Mass Index) calculator.
  43. Python | Program to print Odd and Even numbers from the list of integers.
  44. Python | Program to print Palindrome numbers from the given list.
  45. Python | Compute the net amount of a bank account based on the transactions.
  46. Python | Count total number of bits in a number.
  47. Python | Generate random number using numpy library.
  48. Python | Program to calculate n-th term of a Fibonacci Series
  49. Python program to calculate prime numbers (using different algorithms) upto n
  50. Python program for not None test
  51. Python program to check whether a string contains a number or not
  52. Python program for pass statement
  53. Python program to define an empty function using pass statement
  54. Python program for Zip, Zap and Zoom game
  55. Python program to convert temperature from Celsius to Fahrenheit and vice-versa
  56. Python program to find the number of required bits to represent a number in O(1) complexity
  57. Python program to count number of trailing zeros in Factorial of number N

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

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 an array of bytes representing an integer

Python Class and Object programs

  1. Python | Create Employee Class
  2. Python | Create Employee Class with Constructor and Destructor


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


  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

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 string using stack and reversed method
  17. Split a string into array of characters in Python
  18. Python program for slicing a string
  19. Python program to repeat M characters of a string N times
  20. Python program to swap characters of a given string
  21. Python program to remove a character from a specified index in a string
  22. Python program for adding given string with a fixed message

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 | Demonstrate an example of Class and Object
  2. Python | Simple program of a class (Input and print a number)
  3. Public variables in Python
  4. Python | Create Employee class with some attributes and methods
  5. Python | Example to implement destructor and constructors using __del__() and __init__()
  6. Python | Example to implement Getters and Setters in a class
  7. Python | Implementing setters and getters with the help of properties
  8. Python | Implement Abstraction using Abstract class
  9. Python | Implement Interface using class

Python Regex programs

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

Searching programs

  1. Python program for Binary Search


  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

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.