temp = input("목록을 입력하세요 : ")
nums = [int(item) for item in temp if item != ' ']
temp = int(input("어느 원소를 삭제할까요? : "))
while True:
if temp in nums:
nums.remove(temp)
else:
break
print("삭제 후 목록 : " + str(nums))
수고땡
temp = input("목록을 입력하세요 : ")
nums = [int(item) for item in temp if item != ' ']
temp = int(input("어느 원소를 삭제할까요? : "))
while True:
if temp in nums:
nums.remove(temp)
else:
break
print("삭제 후 목록 : " + str(nums))
수고땡
[int(item) for item in temp if item != ' '] 이거 완전 개새끼네ㅋㅋㅋㅋㅋㅋㅋㅋ
두자리수 입력하면 어쩔거냐?
map(int, temp.split()) 하면 되겠지
지가 알아서 split 쓰것지
그러고 보니 Python 3에서는 map의 결과가 map 객체로 나오던가
ㅇㅇ
nums = list(map(int, temp.split()))
map 쓰려면 이렇게
근데 누가 이미 답글을 달아놨네 씨아앙!!
파이썬 2.7 버젼이고 안됩니다....