Last Updated on April 28, 2023 by Prepbytes

In technical interviews, Python programs are commonly used to evaluate a candidate’s proficiency in the language, problem-solving skills, and ability to write efficient and effective code. Questions related to Python programming may cover topics such as control structures, data types, functions, modules, algorithms, and data manipulation.

## About Python Programming Language

Python is a high-level, interpreted programming language that is widely used for various applications such as web development, data analysis, machine learning, and artificial intelligence. It was created by Guido van Rossum in 1991 and is known for its simplicity, readability, and ease of use. Python supports multiple programming paradigms, including object-oriented, functional, and procedural programming.

## List of Python Programs for Practice for Beginners

Here is the list of basic Python programs for practice for beginners.

### 1. Add Two Numbers

In this program, we will be given two integers. We have to calculate the sum of the two numbers and print it on the output screen. To add these two numbers, we will use the ‘+’ operator. Check the above link for learning about more ways to add two numbers in Python.

**Input 1:**

`4 7`

**Output 1:**

`11`

**Input 2:**

`2 7`

**Output 2:**

`9`

### 2. Even Odd Number

In this Python program, we will be given an integer and we have to check whether the entered number is even or odd and output it on the screen. A number is said to be even is can be divided by 2 completely i.e., it leaves the remainder as 0 when divided by 0. On the other hand, the odd numbers leave the remainder of 1 when divided by 2. To calculate the remainder, we will use the ‘%’ operator.

**Input 1:**

`10`

**Output 1:**

`Even`

**Input 2:**

`7`

**Output 2:**

`Odd`

### 3. Reverse a Number

The Reverse Number program in Python takes a positive number as an input and then reverses the digits of the number and then prints it on the output screen. In Python, this can be achieved either by using string slicing or by using a while loop to extract and concatenate the digits in reverse order. Check out the above link for a detailed explanation and code.

**Input:**

`67884`

**Output:**

`48876`

### 4. Armstrong Number

An Armstrong number is a number that is equal to the sum of its digits raised to the power of the number of digits in the number. The Armstrong Number program takes an integer as an input and prints “Yes” or “No” on the screen based on whether the entered number is an Armstrong number or not. This program can be implemented by using the while loop and with logic as explained in the link.

**Input:**

`153`

**Output:**

`Yes`

### 5. Leap Year Program

A leap year program in Python takes a year as input and checks if the year is a leap year or not. A leap year is a year that follows any one of the below-specified conditions:

Year divisible by 400.

Year divisible by 4 but not by 100.

**Input 1:**

`2000`

**Output 1:**

`Yes`

**Input 2:**

`1877`

**Output 2:**

`No`

### 6. Convert Celcius to Fahreinheit

Many times in real life, we need to convert the temperature in Celsius into Fahrenheit. In this program, we need to convert the given temperature in Celsius to Fahrenheit. Here is the formula for the conversion.

`Fahrenheit = (1.8 * celsius) + 32;`

Follow the above link for a more detailed explanation and code implementation in Python language.

**Input:**

`10`

**Output:**

`50`

### 7. Factorial of a Number

The Factorial of a number is defined as the product of all integers from 1 to n. The factorial program in Python takes an integer as input and prints the factorial of the number on the screen. This program can be implemented using loops or recursive functions to calculate the factorial of the input number and then output the result. For the code implementation and more approaches for this basic Python program, follow the above link.

**Input:**

`5`

**Output:**

`120`

### 8. Anagram Program

The Anagram Program takes two strings as input and tells whether the first string is an anagram of the second string or not. An anagram is a word or phrase formed by rearranging the letters of another word or phrase. For a detailed discussion, follow the above link.

**Input:**

```
listen
silent
```

**Output:**

`Yes`

### 9. Fizzbuzz Program

The Fizzbuzz program is generally asked to check the candidate’s proficiency in the loops in Python. The Fizzbuzz program prints the number from 1 to n with the following modifications.

- For numbers divisible by 3, it prints "Fizz" instead of the number.
- For numbers divisible by 5, it prints "Buzz" instead of the number.
- For numbers divisible by both 3 and 5, it prints "FizzBuzz" instead of the number.

This program can easily be implemented using loops and conditional statements. For a detailed discussion, follow the link given above.

**Input:**

`20`

**Output:**

```
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
```

### 10. Prime Number

A prime number is defined as a number that is divisible only by 1 and itself. The prime number program in Python takes a number as an input and prints “Yes” or “No” on the basis of whether the entered number is prime or not. Follow the above link, to learn more facts and approaches to solve this program.

**Input 1:**

`11`

**Output 1:**

`Yes`

**Input 2:**

`21`

**Output 2:**

`No`

**Conclusion**

In this article, we have discussed the basic Python programs for practice for beginners. By understanding and practicing these programs, beginners can enhance their knowledge of the Python language and develop their problem-solving skills. Hope this article helps in the enhancement of your knowledge.

**You May Also Like to Read**

Menu Driven Program in Python

Python Program to Reverse a String

Python Program to find the middle of a linked list using only one traversal

Pattern Program in Python

Python Program to Reverse a linked list

Python Program For Binary Search

Python Program to Print the Fibonacci Series

Bubble Sort Program in Python

Calculator Program in Python

Python Program to Find the Length of String

Python Program for Insertion Sort

Python Program to Check Palindrome Number

Python Program for Merge Sort

String Programs in Python

Python Program to Convert a List to String

List Program in Python

Python Hello World Program

Python Loop Program

datetime Program in Python