Python Exercise (Sorting Input Values from Small to Large)

Enter three integers a, b, and c, please output them in ascending order
a=eval(input("please enter the first number :")) #you can also write it as a,b,c=xxx
b=eval(input("please enter the second number :")) #eval for numerical type 
c=eval(input("please enter the third number :"))
print(sorted([a,b,c]))

Input 1 3 2
Running results:

[1, 2, 3]

Related articles