<백준 10871번 X보다 작은 수>
from sys import stdin
N ,X = map (int, stdin.readline().split())
Nlist = list(map(int,stdin.readline().split()))
for cha in Nlist:
if cha < X :
print(cha, end=" ")
리스트에다 쫙 넣고 싶으면 list(map(int,input()))~
<백준 10952번 A + B - 5>
from sys import stdin
while(1):
A, B = map (int, stdin.readline().split())
if A==B==0 :
break
print(A+B)
<백준 10951번 A + B - 4>
예외 처리
try,except( else, finally)
https://blockdmask.tistory.com/537
[python] 파이썬 예외처리 try, except, else, finally 사용 방법
안녕하세요. BlockDMask입니다. 오늘은 파이썬에서 예외를 처리하는 방법에 대해서 이야기해보려 합니다. <목차> 1. 예외란? 예외처리 방법 try except 2. 예외 처리 방법 try, except, else, finally 2-1) try..
blockdmask.tistory.com
from sys import stdin
while(1):
try:
A, B = map (int, stdin.readline().split())
print(A+B)
except:
break
<백준 10818번 최소,최대>
from sys import stdin
N = int( stdin.readline())
Nlist = list(map (int, stdin.readline().split()))
print("{0} {1}".format(min(Nlist),max(Nlist)))
list도 max(), min() 사용 가능하구낭~
백준 단계별 문제 다 풀었으면 조케따
'짜잘IT' 카테고리의 다른 글
22.08.27 백준풀기 (0) | 2022.08.27 |
---|---|
22.08.21 백준풀기, 개미수열 (0) | 2022.08.15 |
22.08.14. 백준풀이 (0) | 2022.08.14 |
22.08.12 백준풀기 (0) | 2022.08.12 |
22.08.11 백준풀기 (0) | 2022.08.11 |