String of Numbers
Write a function called
string_of_numbers that receives an integer
and uses a while loop to create and return a string of consecutive numbers from 1 up to the number
>>> string_of_numbers(3) '123' >>> string_of_numbers(5) '12345'
You'll need variables to store your result string and a number keeping track of what loop your on.
You might need to use the str() function to change an integer into a string at some point.
Important: We've recorded a video with the solution of this exercise, in case you get stuck: https://youtu.be/i5Ve2ePni00.
def string_of_numbers(length): number_string = "" count = 1 while count <= length: number_string += str(count) count += 1 return number_string