0
Write a function which takes a number as argument and calculates its cube. If no no.is entered, then it calculates the cube of 2
2 Réponses
+ 2
Kashish Juneja
#return the value from the function then print the returned value.
def c(a=2):
r =a*a*a
return r
n = eval(input('Enter a num: '))
if n==None:
print(c())
else:
print(c(n))
0
def c(a=2):
r =a*a*a
print(r)
return r
n = eval(input('Enter a num: ')
if n==None:
c = c()
else:
c = c(n)