게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
파이썬 함수관련 질문있습니다.
게시물ID : programmer_18669짧은주소 복사하기
작성자 : RealHeadS
추천 : 0
조회수 : 488회
댓글수 : 1개
등록시간 : 2016/10/10 03:16:03
옵션
  • 베오베금지
  • 본인삭제금지
def repeat_string(x):
x += x

def repeat_list(x):
x.extend(x)

position = ["first", "second", "third", "fourth"]
double_position = position
repeat_list(double_position)

count = "123456789"
double_count = count
repeat_string(double_count)

print(position)
print(double_position)
print(count)
print(double_count)
출력값 :
["first", "second", "third", "fourth", "first", "second", "third", "fourth"] ["first", "second", "third", "fourth", "first", "second", "third", "fourth"] 123456789 123456789

여기서 왜 리스트는 position 하고 double_position 둘 다 반복되고 문자열은 그대로인지 전혀 모르겠어요. 
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호