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
8 odpowiedzi
+ 1
u can use while
+ 1
a=.....
b=.......
while len(a)>len(b):
print(a)
while len(b)>len(a)
print (b)
+ 1
explain
+ 1
yeah i did it
+ 1
coding is a very vast thing i began it last month....
there are still lots of functions to study..
0
it is just like if
i search for shorter maybe use max function
0
when did u began?
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)