# Easy Python Program Examples for Beginners

Python, as we know, is the easiest and most efficient language that you start learning code in. The language is an interpreted, object-oriented programming language developed by Guido van Rossum in 1991. It is an industry staple and is preferred in many fields as the language to code in, like Machine Learning, Data Science, etc. The language over time has become quite popular and an industry staple. To meet that advanced level of python for meeting the industry standards, you should first start with the basic symbols and syntax of the python programming language. Thus in this article, we have listed the five most basic python programs that you can refer to start with your python coding. We have provided a problem statement along with a code solution to help you get through this. These python program basics will be the building blocks for all the knowledge you acquire in the later years.

In his exercise, we have used the Jupyter notebook. So now, without further ado, let’s get into the python programming examples.

# Python programs list:

**Problem statement 1 –** Write a python program to convert Fahrenheit into degrees Celsius and vice versa.

**Description –** Here in this program, our goal is to design a simple code that will take input from a user and convert a given temperature from Fahrenheit to celsius and celsius to Fahrenheit.

As we know, the formula for the conversion is –

C = 5/9 * (F – 32)

We will use this formula for converting Fahrenheit to celsius.

As for celsius to Fahrenheit conversion, twist the formula a bit to make it.

F = C * (9/5) + 32.

**Source code –**

**Problem statement 2 – **Write a python program to check whether a number is a palindrome or not.

**Description –** If you are unfamiliar with the term “palindrome number,” let us tell you what it is. A palindrome number is a number that reads the same, both forwards and backward. It can also be defined as a number that remains the same even when the digits are reversed. Examples of palindrome numbers include – 15651, 321454123, 7852587, etc.

To find whether a number is a palindrome or not, we first assign two variables, rev and temp. In temp, we keep the user input n. Now we check a condition to see if n is a positive number or not. If the number is positive, we find out the reverse of the number and check if the user input and the reserve number are the same. If they are the same, then the number is a palindrome. Else it isn’t.

**Source code –**

**Problem statement 3 – **Write a python program to check whether a number given by the user is Armstrong or not.

**Description – **An Armstrong number is a number that is equal to the summation of the cube to each digit of the number itself. Examples are 0, 1, 153, 370 etc.

How ? for 0 – 03 + 03 + 03 = 0.

For 153 – 13 + 53 + 33 = 153.

It is very easy to find an Armstrong number. All you have to do is take out each digit from the user input and use the modulus operator (%) to find the last digit and cube each digit. Then add all the numbers and compare to see if it matches the user input or not.

**Source code –**

**Problem statement 4 – **Write a python program to check whether a number given by the user is prime or not.

**Description – **We all were taught in our earlier school days that a prime number is a number that can be divided into either one or itself. The definition itself is the logic behind the code. You need to use if statements to check if the number, when divided, leaves the remainder 0 or not.

**Source code –**

**Problem statement 5 – **Write a python program to check whether a year given by the user is a leap year or not.

**Description – **A leap year has 366 days instead of 365 days as an extra day is added to February. It occurs once every four years. Judging from the last statement, it is evident that it is precisely what you need to check while writing the code for leap year. You have to go through three conditions to avoid any error possibly. First, you have to check for divisibility by 4, next by 100, and lastly by 400. If it matches all the conditions, then the year is a leap year, else not.

**Source Code –**

**Conclusion **

In the article, we have discussed a python program to check prime numbers, a python program to check palindrome or not, a python program for leap year, a python program for Armstrong numbers, and a python program for temperature conversion. These are the most basic python programs taught in educational institutions when you start to learn python. In addition, these give a basic idea about looping if statements and how indentation in python works. We hope that our article will help you know these codes and learn the logic and formulas behind them.