Python Programs List

Python Programs: Basic

  1. Python program to print “Hello World!”
  2. Python program to read dta from keyboard
  3. Python program to add two numbers
  4. Python program to find average of two numbers
  5. Python program to find absolute value of number
  6. Python program to print number, its square and cube
  7. Python program to demonstrate use of formatting (%0.2d, %0.4f)
  8. Python program to demonstrate use of data types (int, float, char, double)
  9. Python program to print size of all data types
  10. Python program to print ASCII value of entered character
  11. Python program to convert case of entered character

Python Programs: Operators

  1. Python program to demonstrate various arithmetic operation (+, -, *, /, %, ^)
  2. Python program to demonstrate comparison operator (<, >, <=, >=, ==, !=)
  3. Python program to demonstrate logical operator (&&, ||, ! )
  4. Python program to demonstrate increment / decrement operator (++, –)
  5. Python program to demonstrate compound operator (+=, -=, *=, /=)
  6. Python program to demonstrate bit wise operator (&, |, <<, >>, ~)
  7. Python program to demonstrate ternary operator (?)
  8. Python program to find quotient and remainder of number
  9. Python program to swap two numbers
  10. Python program to Add two different time

Python Programs: Area and Volume

  1. Python program to Find area of circle
  2. Python Program to Find Area of Semi Circle
  3. Python Program to Find Diameter, Circumference and Area of Circle
  4. Python Program to Find Area of Triangle
  5. Python Program to Find Third Angle of Triangle
  6. Python Program to Find Area of an Isosceles Triangle
  7. Python Program to Find Area of an Equilateral Triangle
  8. Python Program to Find the Perimeter of a Square
  9. Python Program to Find Area of Rectangle
  10. Python Program to Find Perimeter of Rectangle
  11. Python Program to Find Area of a Parallelogram
  12. Python Program to Find Area of a Rhombus
  13. Python Program to Find Perimeter of a Rhombus

Python Programs: Volume and Surface

  1. Python Program to Compute Volume and Surface Area of a Cube
  2. Python Program to Compute Volume and Surface Area of a Cuboid
  3. Python Program to Compute Volume and Surface Area of a Cone
  4. Python Program to Compute Volume and Surface Area of Sphere
  5. Python Program to Compute Volume and Surface Area of a Cylinder

Python Programs: Equations

  1. Python Program to Find Roots of Quadratic Equation
  2. Python Program to Compute Area of Circle
  3. Python Program to Compute Simple Interest
  4. Python Program to Compute Gross Salary From Basic, DA and HRA
  5. Python Program to Convert From Celsius to Fahrenheit
  6. Python Program to Convert From Fahrenheit to Celsius
  7. Python Program to Convert Minutes to Hours
  8. Python Program to Convert Days to Year, Month, Week and day

Python Programs: If-Else

  1. Python Program to Check if Given Number is Positive
  2. Python Program to Check if Given Number is Positive or Negative
  3. Python Program to Check if Given Character is Vowel or Consonant
  4. Python Program to Check Given Year is Leap Year or Not
  5. Python Program to Check if Given Number is Odd or Even
  6. Python Program to Find Maximum Number From Two Numbers
  7. Python Program to Scan Age of Candidate and Print if He/She is Eligible for Driving Licence or Not
  8. Python Program to Print Gender (‘F’, ‘f’: Female,…)
  9. Python Program to Check Type of Triangle
  10. Python Program to Check if Triangle is Valid or Not using Angles
  11. Python Program to Check if Triangle is Valid or Not using Sides
  12. Python Program to Find Largest of Three Numbers.
  13. Python Program to Print the Grade Based on Percentage
  14. Python Program to Check if Given Number is Integer or Float

Python Programs: Patterns

Pattern 1:
* * * 
* * * 
* * * 
Pattern 2:
* * * 
*   * 
* * *
Pattern 3:
* * * * * * 
* * * * * * 
* * * * * *
Pattern 4:
* * * 
* * * 
* * *
* * *
* * *
Pattern 5:

* 
* * 
* * *
 
Pattern 6:

* * *
* *
*

Pattern 7:
  *
 * *
* * *
Pattern 8:
* * *
 * *
  *
Pattern 9:
    *
  * *
* * *
Pattern 10:

* * *
  * * 
    *
 
Pattern 11:
  *
 * *
* * *
 * * 
  *
Pattern 12:
* * *
 * * 
  *
 * *
* * *
Pattern 13:
* * *
* * 
*
* *
* * *
Pattern 14:
* * *
  * * 
    *
  * *
* * *
Pattern 15:
*
* *
* * *
* * 
*
Pattern 16:
    *
  * *
* * *
  * * 
    *
Pattern 17:
    *
  * * *
* * * * * 
  * * *
    *
Pattern 18:
    *
    *
* * * * * 
    *
    *
Pattern 19:

* * *
    *
    *

Pattern 20:
*     *
 *   * 
   *
 *   *
*     *
Pattern 21:

1 
2 2 
3 3 3

Pattern 22:
  1
 2 2
3 3 3
Pattern 23:
    1  
  2 2 
3 3 3
Pattern 24:
1 
1 2 
1 2 3
Pattern 25:
  1 
 1 2
1 2 3
Pattern 26:
    1 
  1 2 
1 2 3
Pattern 27:
1
2 1
3 2 1
Pattern 28:
  1
 2 1
3 2 1 
Pattern 29:
    1
  2 1
3 2 1
Pattern 30:
1
2 3
4 5 6
Pattern 31:
3 3 3
2 2
1
Pattern 32:
3 3 3
 2 2
  1
Pattern 33:
3 3 3
  2 2
    1
Pattern 34:
1 2 3
1 2 
1
Pattern 35:
1 2 3
 1 2
  1
Pattern 36:
1 2 3
  1 2 
    1
Pattern 37:
3 2 1 
2 1 
1
Pattern 38:
3 2 1 
 2 1 
  1
Pattern 39:
3 2 1 
  2 1 
    1 
Pattern 40:
*
* #
* # *
Pattern 41:
3
2 2 
1 1 1
Pattern 42
  3
 2 2
1 1 1
Pattern 43:
    3
  2 2 
1 1 1
Pattern 44:
3
3 2
3 2 1
Pattern 45:
  3
 3 2
3 2 1
Pattern 46:
    3
  3 2
3 2 1
Pattern 47:
3
2 3
1 2 3
Pattern 48:
  3
 2 3
1 2 3
Pattern 49:
    3
  2 3
1 2 3
Pattern 50:
*
# *
# * #
Pattern 51:
1 1 1 
2 2 
3 
Pattern 52:
1 1 1
 2 2
  3 
Pattern 53:
1 1 1 
  2 2 
    3 
Pattern 54:
3 2 1
3 2
3
Pattern 55:
3 2 1
 3 2
  3
Pattern 56:
3 2 1
  3 2
    3
Pattern 57:
1 2 3
2 3
3
Pattern 58:
1 2 3
 2 3
  3
Pattern 59:
1 2 3
  2 3
    3
Pattern 60:
*
# *
# # *

Note: Python version of the following programs will be available soon, Stay Tuned!

C Programs: Switch-Case

  1. C Program to Check if Given Number is Odd or Even using Switch Case
  2. C Program to Print Day Based on Given Number using Switch Case
  3. C Program to Print Gender using Switch Case (‘F’, ‘f’: Female,…) 
  4. C Program to Implement Calculator  Using Switch Case

C Programs: For Loop

  1. C Program to Print “Hello world” 10 Times using For loop
  2. C Program to Print First n Numbers using For loop
  3. C Program to Print First n Numbers in Reverse Order using For loop
  4. C Program to print odd numbers between 1 to n using For loop
  5. C Program to print first n odd numbers using For loop
  6. C Program to Add All Numbers up To n  using For loop (1 + 2 + 3 + …. + n)
  7. C Program to display a-z characters using For loop
  8. C Program to print multiplication table of 5 using For loop (5 x 1 = 5)
  9. C Program to print multiplication table of n up to m using For loop
  10. C Program to Find Factorial of n using For loop
  11. C Program to Print Fibonacci Series using For loop
  12. C Program to print nPr using For loop
  13. C Program to print nCr using For loop
  14. C Program to count number of digits in given number using For loop
  15. C Program to Add Digits of Number using For loop
  16. C Program to print First Digit of Number using For loop
  17. C Program to print First and Last Digit of a Number using For loop
  18. C Program to Swap First and Last Digit of a Number using For loop
  19. C Program to Reverse The Number using For loop
  20. C Program to Print Numbers Between 1 and n Divisible By m using For loop
  21. C Program to Print All Divisor of Number using For loop
  22. C Program to Check if Given Number is Prime or Not using For loop
  23. C Program to Print First n Prime Numbers using For loop
  24. C Program to Print All Prime Numbers Between 1 and n using For loop
  25. C Program to Print All Prime Numbers Between n and m using For loop
  26. C Program to Check If Given Number is Palindrome or Not using For loop
  27. C Program to Print First n Palindrome Numbers using For loop
  28. C Program to Print All Palindrome Numbers Between 1 and n using For loop
  29. C Program to Print All Palindrome Numbers Between n and m using For loop
  30. C Program to Check if Give Number is Armstrong or Not using For loop
  31. C Program to Print First n Armstrong Numbers using For loop
  32. C Program to print all Armstrong numbers Between 1 and n using For loop
  33. C Program to print all Armstrong numbers Between n and m using For loop
  34. C Program to Check the Number is a Krishnamurthy Number using For loop
  35. C Program to Check if Given Number is Perfect Square or Not using For loop
  36. C Program to Check Number is a Prime, Armstrong, or Perfect Square using For loop
  37. C Program to Print if Numbers Are Same or Not by Comparing Individual Digits. using For loop
  38. C Program to Find GCD Two Numbers using For loop
  39. C Program to Find LCM of Two Numbers using For loop
  40. C Program to Find All Factors of Number using For loop
  41. C Program to Find Prime Factors of Number using For loop

C Programs: While Loop

  1. Write C Program to Print “Hello world” 10 Times using While loop
  2. Write C Program to Print First n Numbers using While loop
  3. Write C Program to Print First n Numbers in Reverse Order using While loop
  4. Write C Program to print odd numbers between 1 to n using While loop
  5. Write C Program to print first n odd numbers using While loop
  6. Write C Program to Add All Numbers up To n  using While loop (1 + 2 + 3 + …. + n)
  7. Write C Program to display a-z characters using While loop
  8. Write C Program to print multiplication table of 5 using While loop (5 x 1 = 5)
  9. Write C Program to print multiplication table of n up to m using While loop
  10. Write C Program to Find Factorial of n using While loop
  11. Write C Program to Print Fibonacci Series using While loop
  12. Write C Program to print nPr using While loop
  13. Write C Program to print nCr using While loop
  14. Write C Program to count number of digits in given number using While loop
  15. Write C Program to Add Digits of Number using While loop
  16. Write C Program to print First Digit of Number using While loop
  17. Write C Program to print First and Last Digit of a Number using While loop
  18. Write C Program to Swap First and Last Digit of a Number using While loop
  19. Write C Program to Reverse The Number using While loop
  20. Write C Program to Print Numbers Between 1 and n Divisible By m using While loop
  21. Write C Program to Print All Divisor of Number using While loop
  22. Write C Program to Check if Given Number is Prime or Not using While loop
  23. Write C Program to Print First n Prime Numbers using While loop
  24. Write C Program to Print All Prime Numbers Between 1 and n using While loop
  25. Write C Program to Print All Prime Numbers Between n and m using While loop
  26. Write C Program to Check If Given Number is Palindrome or Not using While loop
  27. Write C Program to Print First n Palindrome Numbers using While loop
  28. Write C Program to Print All Palindrome Numbers Between 1 and n using While loop
  29. Write C Program to Print All Palindrome Numbers Between n and m using While loop
  30. Write C Program to Check if Give Number is Armstrong or Not using While loop
  31. Write C Program to Print First n Armstrong Numbers using While loop
  32. Write C Program to print all Armstrong numbers Between 1 and n using While loop
  33. Write C Program to print all Armstrong numbers Between n and m using While loop
  34. Write C Program to Check the Number is a Krishnamurthy Number using While loop
  35. Write C Program to Check if Given Number is Perfect Square or Not using While loop
  36. Write C Program to Check Number is a Prime, Armstrong, or Perfect Square using While loop
  37. Write C Program to Check if All Digits of Number Are Same or Not using While loop
  38. Write C Program to Find GCD Two Numbers using While loop
  39. Write C Program to Find LCM of Two Numbers using While loop
  40. Write C Program to Find All Factors of Number using While loop
  41. Write C Program to Find Prime Factors of Number using While loop

C Programs: Do-While Loop

  1. Write C Program to Demonstrate Use of do-while loop
  2. Write Menu Based C Program to Implement Simple Calculator using do-while loop
  3. Write Menu Based C Program to Print First 10 Positive or Negative Numbers using do-while loop
  4. Write Menu Based C Program to Convert Current Time to Different Time Zone using do-while loop

C Programs: Number System / Base Conversion

  1. Write C Program to Convert Decimal to Binary
  2. Write C Program to Convert Decimal to Octal
  3. Write C Program to Convert Decimal to Hexadecimal
  4. Write C Program to Convert Binary to Decimal
  5. Write C Program to Convert Binary to Octal
  6. Write C Program to Convert Binary to Hexadecimal
  7. Write C Program to Convert Octal to Binary
  8. Write C Program to Convert Octal to Decimal
  9. Write C Program to Convert Octal to Hexadecimal
  10. Write C Program to Convert Hexadecimal to Binary
  11. Write C Program to Convert Hexadecimal to Octal
  12. Write C Program to Convert Hexadecimal  to Decimal

C Programs: Array

  1. Write C Program to Initialize an Array in Program and Print it
  2. Write C Program to Scan and Print Array of Size n
  3. Write C Program to Print Array in Reverse Order
  4. Write C Program to Find Number of Elements in Array
  5. Write C Program to Find an Element From an Array (Linear Search)
  6. Write C Program to Add All the Elements of an Array
  7. Write C Program to Find Average of Elements of an Array
  8. Write C Program to find Mean, Variance and Standard Deviation of an Array
  9. Write C Program to Check if Given Array is Sorted or Not
  10. Write C Program to Find Maximum and Minimum From Array
  11. Write C Program to Find Second Smallest and Second Largest Element from an Array
  12. Write C Program to Count Positive, Negative and Zeros in an Array
  13. Write C Program to Sum Positive and Negative Elements in Array
  14. Write C Program to Compare Two Arrays
  15. Write C Program to Count Odd and Even Numbers in Given Array
  16. Write C Program to Count Occurrence of Given Element in an Array
  17. Write C Program to Replace Array Elements by Given Value
  18. Write C Program to Delete Duplicate Element From an Array
  19. Write C Program to Delete Element From an Array by Value
  20. Write C Program to Delete Element From an Array by Location
  21. Write C Program to Insert an element in an Array at Given Location
  22. Write C Program to Implement Binary Search

C Programs: Matrix

  1. Write C Program to Initialize 3 x 3 Matrix and Print it
  2. Write C Program to Scan and Print 3 x 3 Matrix 
  3. Write C Program to Add Two Matrices of Size 3 X 3.
  4. Write C Program to Multiply Two Matrices of Size 3 X 3.
  5. Write C Program to Find Norm and Trace of Matrix of Size 3 X 3.
  6. Write C Program to Find Row Sum and Column Sum of Matrix of Size 3 X 3.
  7. Write C Program to Find Sum of Diagonal, and Non Diagonal Elements of 3X3 Matrix
  8. Write C Program to Traverse Matrix Helically.
  9. Write C Program to Check if Given Matrix is Magic Matrix or Not
  10. Write C Program to Print Lower and Upper Triangle of Matrix
  11. Write C Program to Compute Transpose of Matrix

C Programs: String

  1. Write C Program to Initialize and Print String
  2. Write C Program to Scan and Print String
  3. Write C Program to Demonstrate the Use of gets() Function
  4. Write C Program to Find Length of String
  5. Write C Program to Reverse String
  6. Write C Program to Count Number of Occurrence of Character in String
  7. Write C Program to Compare Two Strings
  8. Write C Program to Copy String in Another String
  9. Write C Program to Concat Two Strings
  10. Write C Program to Check if Given String is Palindrome or Not
  11. Write C Program to Delete White Spaces From the String
  12. Write C Program to Remove all Vowels From String
  13. Write C Program to Count Vowel, Consonant and White Space from String.
  14. Write C Program to Convert String in Upper Case, Lower Case and Toggle Case
  15. Write menu-driven Program to Convert String in Upper Case, Lower Case and Toggle Case using do-while loop
  16. Write C Program to Delete Given Character From the String
  17. Write C Program to Insert Sub String at Specific Location
  18. Write C Program to Find Sub String from the Given String
  19. Write C Program to Count Occurrence of Word in Given String
  20. Write C Program to Remove Given Word From the String
  21. Write C Program to check valid username and password (print: success or failure)

Python Programs: Recursion

  1. Write Python Program to Print First N Numbers using Recursion
  2. Write Python Program to Add Two Numbers using Recursion
  3. Write Python Program to Add Digits of Number using Recursion
  4. Write Python Program to Find Factorial of Number Using Recursion
  5. Write Python Program to Find Fibonacci Series Using Recursion
  6. Write Python Program to Find Maximum Number From Array Using Recursion
  7. Write Python Program to Add First n Numbers using Recursion
  8. Write Python Program to Find Sum of All Array Elements Using Recursion
  9. Write Python Program to Search Element From Array Using Recursion
  10. Write Python Program to perform Binary Search using Recursion
  11. Write Python Program to Find GCD of Two Numbers using Recursion
  12. Write Python Program to Find LCM of Two Numbers using Recursion
  13. Write Python Program to Find the Sum of Natural Numbers using Recursion
  14. Write Python Program to Reverse a Number Using Recursion
  15. Write Python Program to Reverse a String Using Recursion
  16. Write Python Program to Check if Given Number is Palindrome or Not using Recursion
  17. Write Python Program to Check if Given String is Palindrome or Not using Recursion
  18. Write Python Program to Calculate the Power using Recursion