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
- identityHashCode
- down casting
- dbeaver
- arraycopy
- singletone
- access modifier
- aice associate
- 엔드포인트
- Aice
- has-a
- parameter group
- Java
- 스트림
- 파이썬
- 넘파이
- pycharm
- extends
- 얕은 복사
- 자바
- Inbound
- Python
- pandas
- 판다스
- generic programming
- Up Casting
- ai능력시험
- public static final
- 파이참
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 |