Answer to Question #225507 in Python for Reclimet

Question #225507

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

1
Expert's answer
2021-08-16T09:14:03-0400
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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS