0

How i ask for longer list

i have 2 lists: a=[1,2,3] b=[1,2,4,6,7] how i print the longer without if? max(len(a),len(b)) give me the highr len which is 5

11th Sep 2016, 11:18 AM
Tal Kenigs
Tal Kenigs - avatar
8 Answers
+ 1
u can use while
11th Sep 2016, 12:03 PM
Ritveak Dugar
Ritveak Dugar - avatar
+ 1
a=..... b=....... while len(a)>len(b): print(a) while len(b)>len(a) print (b)
11th Sep 2016, 12:05 PM
Ritveak Dugar
Ritveak Dugar - avatar
+ 1
explain
11th Sep 2016, 12:05 PM
Tal Kenigs
Tal Kenigs - avatar
+ 1
yeah i did it
11th Sep 2016, 12:06 PM
Ritveak Dugar
Ritveak Dugar - avatar
+ 1
coding is a very vast thing i began it last month.... there are still lots of functions to study..
11th Sep 2016, 12:09 PM
Ritveak Dugar
Ritveak Dugar - avatar
0
it is just like if i search for shorter maybe use max function
11th Sep 2016, 12:07 PM
Tal Kenigs
Tal Kenigs - avatar
0
when did u began?
11th Sep 2016, 12:10 PM
Ritveak Dugar
Ritveak Dugar - avatar
0
a=[1,2,3] b=[1,2,3,7] while len(a)>len(b): print(a) break while len(b)>len(a): print (b) break If break is not used the program will iterate till infinity as len(a) will always be greater than len (b) similarly in the second while loop len(b) will always be greater than len (a)
11th Sep 2016, 2:04 PM
Lunu'anaki
Lunu'anaki - avatar