belongs to collection: Python Basic Exercises for Beginners
For example, If the given int is 7536, the output shall be “6 3 5 7“, with a space separating the digits.
Solution: Use while loop
number = 7536 print("Given number", number) while number > 0: # get the last digit digit = number % 10 # remove the last digit and repeat the loop number = number // 10 print(digit, end=" ")
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution: Use while loop
need an explanation for this answer? contact us directly to get an explanation for this answer