xxxxxxxxxx
number = int(input("Enter a number: ")) # Assuming the user wants to input a number
# Calculate square of the number
square = number ** 2
print("The square of", number, "is", square)
xxxxxxxxxx
## Two ways to square the number x
x ** 2
# Returns: 9
pow(x, 2)
# Returns: 9
xxxxxxxxxx
n = int(input("Enter the Height of Square: "))
# create a nested loop
# from 0 to n
for i in range(n):
for j in range(n):
#print * if the value of
#outer or inner loop value is 0 or n-1
if (i==0 or i==n-1 or j==0 or j==n-1):
print("*", end="")
else:
# else print empty spaces
print(" ", end ="")
print()