Home » Python » Python programs

# Python Basic Programs

This section contains **Python basic programs**, demonstrating the examples on basic concepts such as conditional statement, control statement, small project programs, etc.

## List of Python Basic Programs

- How to print spaces in Python?
- Python | Printing different messages by using different variations of print() method.
- Python program to print given text using a user-defined method
- Python | Printing different values (integer, float, string, Boolean).
- Python | Declare different types of variables, print their values, types and Ids.
- Python program to demonstrate variables scope
- Determine the type of an object in Python
- Create number variables (int, float and complex) and print their types and values in Python
- Create integer variable by assigning binary value in Python
- Create integer variable by assigning octal value in Python
- Create integer variable by assigning hexadecimal value in Python
- Python | Typecasting Input to Integer, Float.
- How to check multiple variables against a value in Python?
- Python | Program to define an integer value and print it.
- Python | Input two integers and find their addition.
- Python program to find sum of two numbers
- Python program to find addition of two numbers (4 different ways)
- Python Arithmetic Operators Example
- Python program to find maximum of two numbers
- Python program to find the area and perimeter of a circle
- Python program to print ASCII value of a character
- Python program for simple interest
- Python program for compound interest
- Python program to check the given year is a leap year or not
- Simple pattern printing programs in Python
- Python program to check whether a given number is a Fibonacci number or not
- Python program to find power of a number using exponential operator
- Python program to find the power of a number using loop
- Python program to find the power of a number using recursion
- Python program to extract and print digits in reverse order of a number
- Python program to reverse a given number (2 different ways)
- Python program to find floor division
- Python | Some of the examples of simple if else.
- Python | Input age and check eligibility for voting.
- Python | Find largest of three number using nested if else.
- Python | Calculate discount based on the sale amount.
- Python | Calculate discount based on the sale amount using Nested if else.
- Python | Example of Ternary Operator
- Python | Design a simple calculator using if elif (just like switch case)
- Python | Demonstrate an example of for loop
- Python | Demonstrate an example of for each loop
- Python | Examples of loops (based on their control)
- Python | Some of the Examples of loops
- Python | Demonstrate an Example of break statement
- Python | Demonstrate an Example of continue statement
- Python | Demonstrate an Example of pass statement
- Python | Program to print numbers from N to 1 (use range() with reverse order).
- Python | Print all numbers between 1 to 1000 which are divisible by 7 and must not be divisible by 5.
- Python | Calculate square of a given number (3 different ways).
- Python | Find factorial of a given number (2 different ways).
- Python | Find the factorial of a number using recursion
- Python | Declare any variable without assigning any value.
- Python | BMI (Body Mass Index) calculator.
- Python | Program to print Odd and Even numbers from the list of integers.
- Python | Program to print Palindrome numbers from the given list.
- Python | Compute the net amount of a bank account based on the transactions.
- Python | Count total number of bits in a number.
- Python | Generate random number using numpy library.
- Generate random integers between 0 and 9 in Python
- Python | Program to calculate n-th term of a Fibonacci Series
- Python program for sum of square of first N natural numbers
- Python program for sum of cube of first N natural numbers
- Python program to check prime number
- Python program to find the largest prime factor of a number
- Python program to find prime numbers using sieve of Eratosthenes
- Python program to calculate prime numbers (using different algorithms) upto n
- Python program to print all prime numbers in an interval
- Python program to print all positive or negative numbers in a range
- Python program for not None test
- Python program for pass statement
- Python program for Zip, Zap and Zoom game
- Python program to convert temperature from Celsius to Fahrenheit and vice-versa
- Python program to find the number of required bits to represent a number in O(1) complexity
- Python program to count number of trailing zeros in Factorial of number N
- Python program for swapping the value of two integers
- Python program for swapping the value of two integers without third variable
- Python program to find winner of the day
- Python program for Tower of Hanoi
- Python program to find standard deviation
- Python program to find the variance
- Python program Tower of Hanoi (modified)
- Python program to convert Centimeter to Inches
- Python program to convert meters into yards
- Python program to convert yards into meters
- Python program to capitalize the character without using a function
- Python program to lowercase the character without using a function
- Python program to find perfect number
- Python program to print perfect numbers from the given list of integers
- Python program to find greatest integer using floor() method
- Python program to find the maximum EVEN number
- Python program to find the maximum ODD number
- Python program to find the solution of a special sum series
- Python | Convert the binary number to decimal without using library function
- Python | Convert the decimal number to binary without using library function
- Create a stopwatch using Python
- Python program to find the maximum multiple from given N numbers
- Python program to find the least multiple from given N numbers
- Find the root of the quadratic equation in Python
- Python program to check the given Date is valid or not
- Python program to print the calendar of any year
- Find all Prime numbers less than or equal to N using the Sieve of Eratosthenes algorithm in Python
- Find the sum of all prime numbers in Python
- Print the all uppercase and lowercase alphabets in Python
- Find the N-th number which is both square and a cube of a number in Python
- Program to find the execution time of a program in Python
- Program to find the x-intercept and y-intercept of a line passing through the given point in Python
- Find the day of the week for a given date in the past or future in Python
- Python program to find the GCD of the array
- Python program to find the LCM of the array elements
- Find the number of integers from 1 to n which contains digits 0's in Python
- Check whether a number is a power of another number or not in Python
- Check whether the binary representation of a given number is a palindrome or not in Python
- Draw a pie chart that shows our daily activity in Python
- Find the sum of all numbers below 1000 which are multiples of 3 or 5 in Python
- Python | How can I force division to be floating point? Division keeps rounding down to 0?
- Python program to declare a function and call it
- Python program to call a function before declaring it - Is it possible?
- Python program to call a function using keyword argument
- Python program to pass function as an argument
- Python program for passing multiple arguments to a function
- Python program to call methods from main() method
- Python program to return function from another function
- Python program to pass parameters to a function
- Create a function to check EVEN or ODD in Python
- Create a function to return the absolute the given value in Python
- Python | Write functions to find square and cube of a given number.
- Python program to define an empty function using pass statement
- Python program to design a dice throw function
- Python program to design a biased dice throw function
- Python program to design a biased coin flip function
- Python program to design a coin flip function
- Python program to print the list of all keywords
- Python program to print the version information
- Python program to find sum of all digits of a number
- Print number with commas as thousands separators in Python
- Python program to demonstrate logical errors
- Python program to print table of number entered by user
- Python program to calculate currency notes required to get the amount
- Python program to calculate discount based on selling price
- Python program to calculate gross pay (Hourly paid employee)
- Python program to get employee details and search for record by ID, surName or Designation
- Python program for Basic Shop Management System
- Python program to import modules – different Methods

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions