I want to take user input and square it by using lambda function
why doesn't this code work?
def my():
x = int(input('Please enter a number: '))
y = lambda x: x**2
print(y)
I want to take user input and square it by using lambda function
why doesn't this code work?
def my():
x = int(input('Please enter a number: '))
y = lambda x: x**2
print(y)
y
is the function, rather than the value the function returns;
def my():
x = int(input('Please enter a number: '))
y = lambda i: i**2
print(y(x))