English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Python Basic Tutorial

Python Flow Control

Python Functions

Python Data Types

Python File Operations

Python Objects and Classes

Python Date and Time

Advanced Python Knowledge

Python Reference Manual

Python example in full

The best way to learn Python is through practice with examples. This page contains examples of basic Python concepts. It is recommended that you refer to the references in these examples and try them yourself. All the programs on this page have been tested and should run on all platforms.

  1. Python program to print Hello world!

  2. Python program to add two numbers

  3. Python program to find the square root

  4. Python program to calculate the area of a triangle

  5. Python program to solve quadratic equations

  6. Python program to swap two variables

  7. Python program to generate random numbers

  8. Python program to convert kilometers to miles

  9. Python program to convert Celsius temperature to Fahrenheit

  10. Python program to check if a number is positive, negative, or 0

  11. Python program to check if a number is odd or even

  12. Python program to check for leap years

  13. Python program to find the largest number among three digits

  14. Python program to check for prime numbers

  15. Python program to print all prime numbers at an interval

  16. Python program to find the factorial of a number

  17. Python program to display the multiplication table

  18. Python program to print the Fibonacci sequence

  19. Python program to check Armstrong numbers

  20. Python program to find Armstrong numbers using intervals

  21. Python program to find the sum of natural numbers

  22. Python program to display using anonymous functions2power

  23. Python program to find numbers divisible by another number

  24. Python program to convert decimal to binary, octal, and hexadecimal

  25. Python program to find the ASCII value of a character

  26. Python program to find the greatest common divisor (HCF) or greatest common factor (GCD)

  27. Python program to find LCM

  28. Python program to find factors of a number

  29. Python program to create a simple calculator

  30. Python program to play cards randomly

  31. Python program to display the calendar

  32. Python program to display the Fibonacci sequence using recursion

  33. Python program to find the sum of natural numbers using recursion

  34. Python program to find the factorial of a number using recursion

  35. Python program to convert decimal to binary using recursion

  36. Python program to add two matrices

  37. Python program to transpose a matrix

  38. Python program to multiply two matrices

  39. Python program to check if a string is a palindrome

  40. Python program to remove punctuation from a string

  41. Python program to sort words in alphabetical order

  42. Python program to explain different set operations

  43. Python program to calculate the number of vowels

  44. Python program to merge emails

  45. Python program to find the size (resolution) of an image

  46. Python program for finding file hash