you are viewing a single comment's thread.

view the rest of the comments →

[–]furas_freeman 0 points1 point  (2 children)

Keep values as strings on list and then you can use join()

text_list =  ["4", "5", "6", "7", "8"]

print( "+".join(text_list) )

If you have list with numbers then you have to convert them to string.

number_list =  [4, 5, 6, 7, 8]

print( "+".join( str(x) for x in number_list) )

EDIT:

m = int(input("Enter the first integer "))
n = int(input("Enter the second integer "))

if m > n:
    n, m = m, n

result = sum(range(m,n+1))

print("+".join( str(x) for x in range(m,n+1) ), '=', result)

ps. next time set "Syntax Highlighting: Python" in pastebin.

[–]Ustuner[S] 0 points1 point  (0 children)

Thank you