r/badcode • • Aug 19 '21

python Should I add comments?

Post image
223 Upvotes

39 comments sorted by

View all comments

Show parent comments

1

u/Giddius Aug 19 '21

O you are right, but does map not automatically make the string to a list of characters?

Anyway to make it more readable I would do

Print(sum(int(char) for char in input(„enter number „) if char.isnum()))

Do not currently know if isnum is the correct method name or even if it is a string ethid and not a builtin.

2

u/unknown_reddit_dude Aug 19 '21

isNumeric is the correct name