+ 1

whats wrong in this code...python

number = int(input("Enter a number:") def cube(number): print number**3 def by_three(number): if number%3 == 0: print "number is divisible by three" else : print "number is not divisible

11th Jun 2017, 2:18 PM
preyash gothane
preyash gothane - avatar
9 odpowiedzi
+ 1
You missed a closing parenthesis in the first line as well.
11th Jun 2017, 3:15 PM
merkrafter
+ 1
yeah got it... :)
11th Jun 2017, 4:50 PM
preyash gothane
preyash gothane - avatar
0
code seems to be okay. Only thing is, that in Python 3.x print is a function, means you have to use parenthesis: print ('something') and you'll have to call your defined functions if you want them to work...
11th Jun 2017, 2:28 PM
Amarie
0
but @amarie the error shown is the 'def cube' ... like they are showing syntaxError: invalid syntax
11th Jun 2017, 2:35 PM
preyash gothane
preyash gothane - avatar
0
you also use parentheses for the print () function?
11th Jun 2017, 3:05 PM
Amarie
0
print (number**3)
11th Jun 2017, 3:05 PM
Amarie
0
yes yes I did all these
11th Jun 2017, 3:14 PM
preyash gothane
preyash gothane - avatar
0
stiil there's a error in statement 'def cube'
11th Jun 2017, 3:15 PM
preyash gothane
preyash gothane - avatar
0
@merkrafter seems to have found the actual problem :)
11th Jun 2017, 3:25 PM
Amarie