Program to find square of a number in Python
In this python program guide, we will learn to write:
-
program to find square of a number in python
Program to find sqaure in Python
Here we will accept an input from user. We will use ** to calculate square, store the output in a variable and finally print the value of the variable.
Please check our video tutorial on program to find square of a number in python:
Given below we write a python program to find the square of a number:
# Owner : TutorialsInhand Author : Devjeet Roy
number = int(input("Enter the number: "))
sq = number ** 2
print("The squared value is:",sq)
The output of the python code to find square of a number is as follows:
PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter the number: 4
The squared value is: 16
Few important points about this program:
1. In Python, we use the "**" operator to do calculations using exponent.
2. The number before "**" is the base, and the number after the operator is the exponent.
write a python program to find the square of a number snapshot:
This wraps up our session on python code to find square of a number or program to find square of a number in python.
Would you like to see your article here on tutorialsinhand.
Join
Write4Us program by tutorialsinhand.com
About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :
Published Date :
Nov 13,2022