list_of_numbers = [1,2,3]
#list_of_numbers라는 리스트가 있을때
#as-is 같은 방법으로 도출할수도 있지만.
#python에서 list의 길이를 알고 있다면
#to-be처럼 해도 된다.
#as-is
first = list_of_numbers[0]
second = list_of_numbers[1]
third = list_of_numbers[2]
#to-be
first, second, third = list_of_numbers
'STUDY' 카테고리의 다른 글
python - (0) | 2022.08.30 |
---|---|
python loop (0) | 2022.08.30 |
python data structures (0) | 2022.08.30 |