- 3
nums = [-1, 2, -3, 4, -5] if all([abs(i) < 3 for i in nums]): print(1) else: print(2
4 ответов
0
2
0
what is your question/problem?
all() function return True if all items of iterable passed as argument are evaluated to True: in the ptovided case, abdolute value of three last elements are not lesser than 3, so else statement is executed ^^
0
2
0
Not all the abs(i) are <3 , so it will print 2.