코드로 우주평화

0114. Are arrow functions odd? 본문

나는 이렇게 학습한다/Algorithm & SQL

0114. Are arrow functions odd?

daco2020 2023. 1. 15. 19:02

Time to test your basic knowledge in functions! Return the odds from a list:

[1, 2, 3, 4, 5]  -->  [1, 3, 5]
[2, 4, 6]        -->  []



Solution:

odds = lambda x: [i for i in x if i & 1]


'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

0116. OOP: Object Oriented Piracy  (0) 2023.01.16
0115. Name on billboard  (0) 2023.01.15
0113. Build a square  (0) 2023.01.13
0112. Tip Calculator  (0) 2023.01.13
0111. You Can't Code Under Pressure #1  (0) 2023.01.12