Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

Today test

 1. Ds coding

n=int(input())
l=list(map(int,input().split()))
for i in range(n-1):
  if(i%2==0):
    l[i],l[i+1]=l[i+1],l[i]
for i in l:
  print(i,end=' ')


2. 

n=int(input())
l=list(map(int,input().split()))
l=l[::-1]
for i in l:
  print(i,end=' ')




Post a Comment

Previous Post Next Post