Python/BOJ
[Python] 백준 10951 A + B - 4
Holywat2r
2021. 8. 21. 13:43
https://www.acmicpc.net/problem/10951
10951번: A+B - 4
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
while True:
try:
a, b = map(int, input().split())
except:
break
print(a + b)
코드 해석
https://holywat2r.tistory.com/117
[Python] try-except 예외처리
예외(exception) 런타임 오류 (runtime error) 프로그램 실행중에 발생하는 오류를 말한다. 파이썬은이러한 예외상황과 오류에 대한 처리를 위해 try except 구문을 사용한다. try-except 사용 try: a, b = map(in..
holywat2r.tistory.com
try- except의 예외처리를 이용한 문제이다.