-3
def print_range (start,end):
    n = start
    while n <= end:
        print (n)
print_range(1,5)

Output should be 12345

Richard K Yu
  • 2,152
  • 3
  • 8
  • 21
Jay modi
  • 1
  • 1
  • Please format your code for better readability. please refer to https://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks – Prish Feb 22 '22 at 17:50
  • Does this answer your question? [How to print without a newline or space](https://stackoverflow.com/questions/493386/how-to-print-without-a-newline-or-space) – Tomerikoo Feb 22 '22 at 18:24

1 Answers1

0

you should do this

def print_range (start,end):
    n = start
    n_string = str(start)
    while n <= end:
        n_string = n_string+str(n)

    print(n_string)

print_range(1,5)
WhiteAB
  • 162
  • 3
  • 11