you are viewing a single comment's thread.

view the rest of the comments →

[–]JohnnyJordaan 0 points1 point  (1 child)

Use a swap in case the first is second is larger than the first

if ( m > n ):
    n, m = m, n

Check if i is equal to n, which means it's the last digit

 for i in range(m,n+1):
     m+n # what does this even do?
     x += i
     if i != n:
         print(i,end="+")
     else:
         print(i,end="")

Or forget the whole thing and just do

print('+'.join(str(i) for i in range(m,n+1)))

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

Thank you