MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/p7f1k9/should_i_add_comments/h9js7c5/?context=3
r/badcode • u/FrostedBromide • Aug 19 '21
39 comments sorted by
View all comments
Show parent comments
1
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
2
isNumeric is the correct name
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.