Skip to main content
deleted 37 characters in body
Source Link
user96495
user96495

05AB1E, 5 4 bytes

Thanks a lot to OP! Now I can save a byte

ŸSΘO

Try it online!

Explanation

Ÿ     Inclusive range
 ¨    Pop, remove the last item
  S   Split the string into individual chars
   Θ  (Vectorizes) Does this character == "1"?
    O Sum the resulting list

05AB1E, 5 4 bytes

Thanks a lot to OP! Now I can save a byte

ŸSΘO

Try it online!

Explanation

Ÿ     Inclusive range
 ¨    Pop, remove the last item
  S   Split the string into individual chars
   Θ  (Vectorizes) Does this character == "1"?
    O Sum the resulting list

05AB1E, 5 4 bytes

Thanks a lot to OP! Now I can save a byte

ŸSΘO

Try it online!

Explanation

Ÿ    Inclusive range
 S   Split the string into individual chars
  Θ  (Vectorizes) Does this character == "1"?
   O Sum the resulting list
added 75 characters in body
Source Link
user96495
user96495

05AB1E, 55 4 bytes

Thanks a lot to OP! Now I can save a byte

Ÿ¨J1¢ŸSΘO

Try it online!Try it online!

Explanation

Ÿ     Inclusive range
 ¨    Pop, remove the last item
  JS   JoinSplit the liststring into individual chars
   Θ The count(Vectorizes) ofDoes allthis 1'scharacter == "1"?
    O Sum the resulting list

05AB1E, 5 bytes

Ÿ¨J1¢

Try it online!

Explanation

Ÿ     Inclusive range
 ¨    Pop, remove the last item
  J   Join the list
    The count of all 1's

05AB1E, 5 4 bytes

Thanks a lot to OP! Now I can save a byte

ŸSΘO

Try it online!

Explanation

Ÿ     Inclusive range
 ¨    Pop, remove the last item
  S   Split the string into individual chars
   Θ  (Vectorizes) Does this character == "1"?
    O Sum the resulting list
Source Link
user96495
user96495

05AB1E, 5 bytes

Ÿ¨J1¢

Try it online!

Explanation

Ÿ     Inclusive range
 ¨    Pop, remove the last item
  J   Join the list
   1¢ The count of all 1's