일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 출력
- bitwise
- 기초100제
- 딥러닝
- 입출력
- 2차원배열
- 불 자료형
- 문자열
- input()
- 반복실행구조
- 아스키코드
- 종합
- 논리연산
- 10진수
- 선택실행구조
- 8진수
- 2진수
- OpenCV
- 불 연산
- 기초 100제
- 비트단위논리연산
- 파이썬
- codeup
- 16진수
- Docker
- face recognition
- 코드업
- 비교연산
- 진수
- 산술연산
- Today
- Total
목록
728x90
반응형
SMALL
파이썬 (105)
DeepFlowest

문제 : 평가를 문자(A, B, C, D, ...)로 입력받아 내용을 다르게 출력해보자. 평가 내용 평가 : 내용 A : best!!! B : good!! C : run! D : slowly~ 나머지 문자들 : what? 답 : 코드 : https://github.com/Yearang-Lee/Algorithm/tree/master/CodeUp Yearang-Lee/Algorithm Contribute to Yearang-Lee/Algorithm development by creating an account on GitHub. github.com

문제 : 점수(정수, 0 ~ 100)를 입력받아 평가를 출력해보자. 평가 기준 점수 범위 : 평가 90 ~ 100 : A 70 ~ 89 : B 40 ~ 69 : C 0 ~ 39 : D 로 평가되어야 한다. 답 : 코드 : https://github.com/Yearang-Lee/Algorithm/tree/master/CodeUp Yearang-Lee/Algorithm Contribute to Yearang-Lee/Algorithm development by creating an account on GitHub. github.com

문제 : 정수 1개가 입력되었을 때, 음(minus)/양(plus)과 짝(even)/홀(odd)을 출력해보자. 답 : 방법1 방법2 코드 : https://github.com/Yearang-Lee/Algorithm/tree/master/CodeUp Yearang-Lee/Algorithm Contribute to Yearang-Lee/Algorithm development by creating an account on GitHub. github.com

문제 : 세 정수 a, b, c가 입력되었을 때, 짝(even)/홀(odd)을 출력해보자. 답 : 방법1 방법2 코드 : https://github.com/Yearang-Lee/Algorithm/tree/master/CodeUp Yearang-Lee/Algorithm Contribute to Yearang-Lee/Algorithm development by creating an account on GitHub. github.com

문제 : 세 정수 a, b, c가 입력되었을 때, 짝수만 출력해보자. 답 : 방법1 방법2 코드 : https://github.com/Yearang-Lee/Algorithm/tree/master/CodeUp Yearang-Lee/Algorithm Contribute to Yearang-Lee/Algorithm development by creating an account on GitHub. github.com

문제 : 입력된 세 정수 a, b, c 중 가장 작은 값을 출력하는 프로그램을 작성해보자. 단, 조건문을 사용하지 않고 3항 연산자 ? 를 사용한다. 답 : 방법1 방법2 설명 : map 함수 정리 부분 참고 => https://deepflowest.tistory.com/70 [파이썬] map 함수 map 함수 : 리스트의 요소를 지정된 함수로 처리해주는 함수 list(map(함수, 리스트)) tuple(map(함수, 튜플)) >>> a = [1.3, 2.4, 5.7] >>> a = list(map(int, a)) >>> a [1, 2, 5] ▶input().split()에 map 쓰기.. deepflowest.tistory.com 코드 : https://github.com/Yearang-Lee/Algo..
map 함수 : 리스트의 요소를 지정된 함수로 처리해주는 함수 list(map(함수, 리스트)) tuple(map(함수, 튜플)) >>> a = [1.3, 2.4, 5.7] >>> a = list(map(int, a)) >>> a [1, 2, 5] ▶input().split()에 map 쓰기 >>> a, b = map(int, input().split()) >>> print(a,b) ▶함수에 map 쓰기 >>> def func(x): return 2*x >>> list(map(func, [1,3,5,7])) [2, 6, 10, 14] 위와 같이 for문을 쓰는 대신 map함수를 사용하여 더 간결한 코드를 작성할 수 있다.

문제 : 입력된 두 정수 a, b 중 큰 값을 출력하는 프로그램을 작성해보자. 단, 조건문을 사용하지 않고 3항 연산자 ? 를 사용한다. [참고] 3개의 요소로 이루어지는 3항(ternary) 연산자는 "조건식 ? (참일 때의 값) : (거짓일 때의 값)” 의 형태로 사용하는 연산자이다. - 조건식의 계산 결과가 참인 경우에는 ':' 왼쪽의 값 또는 식으로 바뀌고, - 거짓인 경우에는 ':' 오른쪽의 값 또는 식으로 바뀐다. 예를 들어 123 > 456 ? 0 : 1 과 같은 표현식은 123 > 456 의 비교연산 결과가 거짓이므로 1이 된다. a>b 의 결과가 참(1)이면 (a>b ? a:b)의 결과는 a가 되고, 거짓(0)이면 (a>b ? a:b)의 결과는 b가 된다. 답 : 파이썬에서 삼항연산자는 ..