Sunday, March 3, 2019

Sorting - Python3

a=[]
b=[]
n=int(input("Enter the size of list:"))
for i in range(n) :
    x=int(input("Enter Value: "))
    a.append(x);
print('\nCreate sorted copy of original list & print both')
print("Original list:"+str(a))
b=sorted(a)
print("Sorted list:"+str(b))

print('\nIn same List')
print(a)
a.sort()
print("Sorted list:"+str(a))

ScreenShot:


No comments:

Post a Comment