First and Last Elements of List
This Program name is First and Last Elements of List. Write a Python program to First and Last Elements of List, it has two test cases
The below link contains First and Last Elements of List question, explanation and test cases
https://docs.google.com/document/d/1LSR6d1QTXfpHGouv_GmIKkL595o6R_IK/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true
We need exact output when the code was run
N = int(input())
if N < 4:
print('Too few elements ')
else:
l = []
for i in range(N):
l.append(int(input()))
l = l[:2] + l[-2:]
print(l)
Comments
Leave a comment