Articles

Program to find square of a number in Python

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

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

 


Basic Python Programs

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 & Data Science Enthusiast
Page Views :    Published Date : Jan 26,2021  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!