#Help with CodeWars

1 messages · Page 1 of 1 (latest)

turbid mural
#

return will stop the rest of your function from running, so your code should be placed before it

#

Also, I'd recommend working on projects instead of coding exercises if you want to expand your python knowledge

#

That's even more wrong lol

#

They want you to write a function to achieve what was asked

#

So your code should be inside the def block

#

but not after the return

upbeat heart
#

think about your code one line at a time and think about what it is doing. if true will always run, so what is the point of that?
you may want to look at a tutorial on functions. everything indented after the def line is in the function. your function only contains return, so it doesnt do anything. Read code from top to bottom

#

Write out in english what you want to do, then write code sequentially to do each task. For example:
Get user input as int
Convert to binary
Count number of 1s in binary (this one you may need to break down into more steps)

Then write code in order to do each step.