Merging Two Sorted lists 🔥

Run Settings
LanguagePython
Language Version
Run Command
lis1 = list(map(int,input().split())) lis2 = list(map(int,input().split())) def MergeSorted(l1,l2): i,j = 0,0 merge = [] while i<len(l1) and j<len(l2): if l1[i] <= l2[j]: merge.append(l1[i]) i+=1 elif l1[i] > l2[j]: merge.append(l2[j]) j+=1 if i < len(l1): merge += l1[i:] elif j < len(l2): merge += l2[j:] return merge print(MergeSorted(lis1,lis2))
Editor Settings
Theme
Key bindings
Full width
Lines