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 | 31 |
Tags
- 스트림
- 깊은 복사
- 얕은 복사
- 내부클래스
- constructor
- Java
- extends
- dbeaver
- arraycopy
- public static final
- shebang
- Up Casting
- 엔드포인트
- Wrapper class
- Stream
- parameter group
- singletone
- node.js
- Inbound
- 파이참
- 셔뱅
- access modifier
- pycharm
- generic programming
- 자바
- down casting
- identityHashCode
- finalize
- lambda
- has-a
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 |