+ 1
7 Antworten
+ 8
You needlessly have put the happy() method inside print. The happy() method does not return anything, so there is no output.
Lose the print and call the method directly. Also, the "break" line has to be indented a bit more, to be aligned with the print statement inside the while loop.
+ 4
The call to happy() shouldn't be inside the call to print(), since happy() doesn't return any value, but prints from within the function. Also it looks like you mean for the break statement to be part of the if statement, in which case you need to indent it to match the indentation of the other statement in the if block.
+ 3
change this line to add the brackets:
x = sum([int(i)**2 for i in x])
+ 3
[int(i)**2 for i in x]
will make a list of the digits of the number input each of which is squared.
if the user were to input "125" this would create a list like
[1, 4, 25]
+ 1
when I input 1 I get a "time limite eceeded" error
0
I think the "break" statement isnt working
0
@ChaoticDawg does this change anything