Python Basics Any/All Functions

preview_player
Показать описание
Learn how to use the built-in any and all functions from python programming

twitter: @python_basics
Рекомендации по теме
Комментарии
Автор

b = 4, 6, 8, 9, 2, 3, 56, 7, 4, 34, 9
if any(b):
print('Yes')
else:
print ('no')
which_nuber_is_true = [True if i == 1 else False for i in b]
print(which_nuber_is_true)




Yes
[False, False, False, False, False, False, False, False, False, False, False]


When the 'any' function was used to find if any are true, it printed 'yes' that some were True.
but when i tried checking which ones were through they all returned false. please how is this maybe i made a mistake. Thanks.

c_t