작성
·
230
답변 1
0
안녕하세요.
튜플() 아니라 SET{} 일 경우는 역순으로 들어갑니다.
# languages list
languages = ['French']
# languages tuple
languages_tuple = ('Spanish', 'Portuguese')
# languages set
languages_set = {'Chinese', 'Japanese'}
# appending language_tuple elements to language
languages.extend(languages_tuple)
print('New Language List:', languages)
# appending language_set elements to language
languages.extend(languages_set)
print('Newer Languages List:', languages)
Output
New Languages List: ['French', 'Spanish', 'Portuguese'] Newer Languages List: ['French', 'Spanish', 'Portuguese', 'Japanese', 'Chinese']