Write a program to enter the numbers till the user wants and at the end the program should display the largest and smallest numbers entered.

Source Code

min_num = 99999
max_num = 0
choice = 'y'

while choice == 'y' or choice == 'Y':
    num = int(input("Enter a number: "))
    if num > max_num:
        max_num = num
    if num < min_num:
        min_num = num
    choice = input("Do you wish to continue (y/n)?: ")

print("Maximum number:", max_num)
print("Minimum number:", min_num)

Output

Enter a number: 25
Do you wish to continue (y/n)?: y
Enter a number: 600
Do you wish to continue (y/n)?: Y
Enter a number: 10
Do you wish to continue (y/n)?: Y
Enter a number: 1024
Do you wish to continue (y/n)?: n
Maximum number: 1024
Minimum number: 10