NPTEL The Joy of Computing using python Week3 Assignment 3 Solutions 2021 | Swayam


 

Ans of Assignment -1
a=input().split()
s=[]
for e in a:
    if e[len(e)-1]!='4':
        s.append(e)
print(*s,end="")

        
Ans of Assignment -2
t=input().split()
s=[]
for e in t:
    if int(e) not in s:
        s.append(int(e))
if len(s)>1:
    a=sorted(s)
    print(a[1]+a[-2],end="")
else:
    print(s[0]*2,end="")

Ans of Assignment -3
(N,q,a)=(input(),[],[])
q=N.split(" ")
for e in q:
    if e not in a:
        a.append(e)
for i in range(0,len(a)):
    if i!=len(a)-1:
        print(a[i],end=" ")
    else:
        print(a[i], end=" ")

No comments:

Powered by Blogger.