길/Python

List Functions

7he8oy 2021. 2. 11. 20:46
nums = [55, 44, 33, 22, 11]

if all([i > 5 for i in nums]):
    print("All larger than 5")

if any([i % 2 == 0 for i in nums]):
    print("At least one is even")

for v in enumerate(nums):
    print(v)

' > Python' 카테고리의 다른 글

decorator  (0) 2021.02.12
Generators  (0) 2021.02.12
String Functions  (0) 2021.02.11
dic.get(key [,default])  (0) 2021.02.11
try / except / finally / assert  (0) 2021.02.11