write a python script to input a number from the user and print its square and cube
Answers
Answered by
9
Answer:
# python program to find square and cube
# of a given number
# User defind method to find square
def square (num):
return (num*num)
# User defind method to find cube
def cube (num) :
return (num*num*num)
# Main code
# input a number
number = int (raw_input("Enter an integer number: "))
# square and cube
print "square of {0} is {1}".format(number, square(number))
print "Cube of {0} is {1}".format(number, cube (number))
Answered by
9
You can place any variables in place of x and y,
In the print function, do not keep double or single quotes.
Hope it helps:)
Attachments:
Similar questions