Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- Stream
- 넘파이
- 엔드포인트
- Java
- ai능력시험
- parameter group
- Inbound
- pycharm
- Aice
- generic programming
- 셔뱅
- aice associate
- access modifier
- has-a
- down casting
- 파이썬
- 얕은 복사
- 판다스
- 파이참
- 자바
- identityHashCode
- public static final
- 스트림
- extends
- Python
- Up Casting
- dbeaver
- singletone
- pandas
- arraycopy
Archives
- Today
- Total
٩(๑•̀o•́๑)و
tuple 본문
# tuple -> immutable!
#1. count, index, map
for i in range(2):
a = tuple(map(int, input().split()))
if a.count(30) > 0:
print(a.index(30))
else:
print('Not Found')
====Result====
1 3 6 8
Not Found
2 5 4 20 30
4
#2. tuple 표현식
- tuple(식 for 변수 in 리스트 if 조건식)
a = tuple(i for i in range(10) if i%3 == 0)
print(a)
b = tuple(i+3 for i in range(6) if i%2 == 0)
print(b)
====Result====
(0, 3, 6, 9)
(3, 5, 7)
'Python' 카테고리의 다른 글
string (0) | 2020.09.10 |
---|---|
2차원 리스트, 튜플 (0) | 2020.09.10 |
map (0) | 2020.09.10 |
list (0) | 2020.09.09 |
break, continue (0) | 2020.09.09 |