#try to avoid input function a = int(input("Enter length of the list :")) b = [int(x) for x in range(1,a+1)] c = len(b) print(b) if a%2 == 1: print(b[c//2]) else: print((b[c//2]+b[c//2-1])/2)
Click the run button. Try to avoid input() function.