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 while True: print("Enter 'x' for exit.") side = input("Enter side length of Square: ") if side == 'x': break else: side_length = int(side) area_square = side_length*side_length print("Area of Square =",area_square,"\n")
Here is the sample run of the above Python program shows how to calculate and print area of a square:
You may also like to learn or practice the same program in other popular programming languages: