n = int(eval(input('Enter a positive integer value: ')))
for i in range(n, 0, -1):
    if i == 1 or i == n:
        print('*' * i)
else:
    print('*' + ' ' * (i - 2) + '*')
How to print this pattern? I cannot get the logic for eliminating the middle part