Python Forum
How to sum up the elements of an integer using python split/join?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to sum up the elements of an integer using python split/join?
#1
I am trying to sum up the elements of an integer using python split join
Here is my code,
-----------------------
a='1234'
b=list(a)
c='+'.join(b)
print© ##output- 1+2+3+4
-------------------------------------
How to get the sum of all the elements
Reply


Messages In This Thread
How to sum up the elements of an integer using python split/join? - by mohanraj1986 - Aug-27-2018, 05:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to remove some elements from an array in python? gohanhango 9 1,186 Nov-28-2023, 08:35 AM
Last Post: Gribouillis
  ValueError: Length mismatch: Expected axis has 8 elements, new values have 1 elements ilknurg 1 5,147 May-17-2022, 11:38 AM
Last Post: Larz60+
  Question about change hex string to integer sting in the list (python 2.7) lzfneu 1 2,531 May-24-2021, 08:48 AM
Last Post: bowlofred
  Testing Split elements tester_V 4 2,456 May-08-2021, 10:54 PM
Last Post: snippsat
  Sorting Elements via parameters pointing to those elements. rpalmer 3 2,600 Feb-10-2021, 04:53 PM
Last Post: rpalmer
  The difference between os.path.join( and os.sep.join( Pedroski55 2 9,464 Nov-17-2020, 08:38 AM
Last Post: Pedroski55
  How does a set in python store the elements? idknuttin 5 2,796 Jul-10-2020, 10:46 PM
Last Post: Gribouillis
  Join table with differnt datype column using python query abhishek6555 1 2,298 Jan-07-2020, 11:44 PM
Last Post: micseydel
  Beginner at Python. Trying to count certain integer from random string of code kiaspelleditwrong 3 2,422 Oct-14-2019, 10:40 AM
Last Post: perfringo
  python cache for small integer Uchikago 1 2,497 Jun-27-2019, 05:32 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020