write a python program to input a number from the user and display n square
Answers
Answered by
12
According to me coding of program is same it can also match with other answer
Note = This is created by me and 100% accurate result
def square number ( ):
num = raw_input (' Enter numbers, eg 1,2,3: ').split(',')
print [int(n) for n in num if n.isdigit()] ##display user input
lst = [ ]
for n in num:
if n.isdigit():
nn = int(n)
lst.append(nn*nn)
print lst
return lst
x = square number( )
[Running the code]
Enter numbers, eg 1,2,3: 1,2,3
[1, 2, 3]
[1, 4, 9]
Anonymous:
Hope you will satisfy with my answer
Answered by
2
It's quite simple.
First, we take the input from the user and then print the square.
As we are talking about n, let's set the variable name as n.
n = float(input('Enter the number:'))
print('The square of',n,'is:',n**2)
Hope my answer helps!
Similar questions