sort (half)

Sai_kiran_rachakonda · June 14, 2022
a = [2,3,8,-1,7,1]
b = [-4, 6, 9, -1, 3]
c = []
d = []
a.sort()
b.sort()
x = len(a) // 2
y = len(b) // 2
for i in range(x):
    if a[i] <= x:
        c.append(a[i])
    if b[i] <= y:
        c.append(b[i])
print(c)
Output

Comments

Please sign up or log in to contribute to the discussion.