In this program, you will learn how to calculate the square of the number.
#Example1: Square of the Number
num = 5
value = num ** 2
print('The square value of {0} number is {1}'.format(num,value))
The square value of 5 number is 25
In this program, the variable num is squared and stored the result to value variable.
Display value result in the format of string
#Example2: Square of the Float
num = input('Enter First Number: ')
value = float(num) ** 2
print('The square value of {0} number is {1}'.format(num, value))
Enter First Number: 25
The square value of 25 number is 625.0
In this program, you can enter your desired number in decemal format to square it.
The entered number value is assinged to num variable.
To square the number, you should type cast each number to float data type.
Display num and value values in the format of string.
The following topics can be useful to understand this program.