i am trying to create function which will show numbers from smallest to largest, using def, not by python built in function like sort(), how can i do this ?
i have tried to search in google to fix this problem
# Data structures --> arrays
print('Welcome')
number = []
nums_len = int(input('Enter how many numbers: '))
def enter_nums():
for nums in range(nums_len):
num = int(input('Enter numbers: '))
number.append(num)
enter_nums()
# O(N) search running speed
maximum = number[0]
minimum = number[0]
for nums in number:
if nums > maximum:
maximum = nums
print(maximum, 'is a max number')
for nums in number:
if nums < minimum:
minimum = nums
print(minimum, 'is a min number')
i already set up application which shows min and max numbers from the list, but i need it to show me numbers from smallest to largest