Blog

python tutorials and learn python

Created with Sketch.

Python program to display calendar

Python program to display calendar It is simple in python programming to display calendar. To do so, you need to import the calendar module which comes with Python. import calendar  And then apply the syntax (calendar.month(yy,mm)) import calendar<br /> And then apply the syntax<br /> (calendar.month(yy,mm))<br /> See this example: import calendar # Enter the month and year yy = int(input(“Enter year: “)) mm = int(input(“Enter month: “)) # display the calendar print(calendar.month(yy,mm)) import calendar<br /> #…
Read more

Python program to convert Celsius to Fahrenheit

Python program to convert Celsius to Fahrenheit Celsius: Celsius is a unit of measurement for temperature. It is also known as centigrade. It is a SI derived unit used by most of the countries worldwide. It is named after the Swedish astronomer Anders Celsius. Fahrenheit: Fahrenheit is also a temperature scale. It is named on…
Read more

Python program to convert kilometers to miles

Python program to convert kilometers to miles Here, we are going to see the python program to convert kilometers to miles. Let’s understand kilometers and miles first. Kilometer: The kilometer is a unit of length in the metric system. It is equivalent to 1000 meters. Miles: Mile is also the unit of length. It is…
Read more

Python program to generate a random number

Generating Random Numbers in Python with Output Random numbers are a crucial aspect of programming, used in various applications such as simulations, games, and statistical analysis. Python provides the random module, which offers functions to generate pseudo-random numbers. In this post, we’ll explore how to generate random numbers in Python. Using the random Module Python’s…
Read more

Python program to swap two variables

Python program to swap two variables Variable swapping: In computer programming, swapping two variables specifies the mutual exchange of values of the variables. It is generally done by using a temporary variable. For example: data_item x := 1 data_item y := 0 swap (x, y) data_item x := 1<br /> data_item y := 0<br /> swap (x, y)<br /> After swapping: data_item x := 0 data_item y := 1…
Read more

Python program to solve quadratic equation

Python program to solve quadratic equation Quadratic equation: Quadratic equation is made from a Latin term “quadrates” which means square. It is a special type of equation having the form of: ax2+bx+c=0 Here, “x” is unknown which you have to find and “a”, “b”, “c” specifies the numbers such that “a” is not equal to…
Read more

Python program to find the area of a triangle

Python program to find the area of a triangle Mathematical formula: Area of a triangle = (s*(s-a)*(s-b)*(s-c))-1/2 Here s is the semi-perimeter and a, b and c are three sides of the triangle. See this example: # Three sides of the triangle is a, b and c: a = float(input(‘Enter first side: ‘)) b = float(input(‘Enter second side: ‘)) c = float(input(‘Enter third side: ‘)) # calculate the semi-perimeter s = (a + b + c) / 2 # calculate the area area = (s*(s-a)*(s-b)*(s-c)) ** 0.5 print(‘The area of the triangle is %0.2f’ %area) # Three sides of the triangle is a, b and…
Read more

Python program to do arithmetical operations

Python Program for Arithmetical Operations Introduction In this Python program, we will create a simple calculator that performs basic arithmetical operations such as addition, subtraction, multiplication, and division. The user can input two numbers and choose the operation they want to perform. We will discuss the algorithm, provide the Python code, and explain how the…
Read more

Python program to print “Hello Python”

Python Program to Print “Hello Python” In this blog post, we’ll explore a simple yet fundamental Python program that prints the iconic message “Hello Python” to the console. The primary goal is to provide a step-by-step explanation of the code and its execution. Readers will gain insights into basic Python syntax, the print function, and…
Read more

Python Programs

Python Programs There can be various python programs on many topics like basic python programming, conditions and loops, functions and native data types. A list of top python programs are given below which are widely asked by interviewer. Basic Python programs Python program to print “Hello Python” Python program to do arithmetical operations Python program…
Read more