"파이썬 pop()"의 두 판 사이의 차이

3번째 줄: 3번째 줄:
;파이썬 pop()
;파이썬 pop()


{{소스헤더|pop()}}
<source lang='python'>
<source lang='python'>
colors = ['red', 'blue', 'green']
fruits = ["Apple", "Banana", "Orange"];
colors.pop()
element = fruits.pop();
print( colors )
print (element)
# ['red', 'blue']
# Orange
print (fruits)
# ['Apple', 'Banana']
</source>
{{소스헤더|pop(0)}}
<source lang='python'>
fruits = ["Apple", "Banana", "Orange"];
element = fruits.pop(0)
print(element)
# Apple
print (fruits)
# ['Banana', 'Orange']
</source>
</source>



2020년 1월 18일 (토) 15:10 판

1 개요

Python pop()
파이썬 pop()
pop()
fruits = ["Apple", "Banana", "Orange"];
element = fruits.pop();
print (element)
# Orange
print (fruits)
# ['Apple', 'Banana']
pop(0)
fruits = ["Apple", "Banana", "Orange"];
element = fruits.pop(0)
print(element)
# Apple
print (fruits)
# ['Banana', 'Orange']

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}