To calculate area of a square in python, you have to ask from user to enter the side length of square to calculate and print the area of that square on the output screen as shown in the program given below.
Following python program ask from user to enter side length of square to print area of the square:
# Python Program - Calculate Area of Square print("Enter 'x' for exit."); side = input("Enter side length of Square: "); if side == 'x': exit(); else: side_length = int(side); area_square = side_length*side_length; print("\nArea of Square =",area_square);
Here is the sample run of the above Python program shows how to calculate and print area of a square:
Now enter the length or side length of the square to calculate and print it's area according to given side of the square as shown in the below sample output:
Here is the same program with run on python shell:
Program Video with Compile and Run
You may also like to learn or practice the same program in other popular programming languages: