https://www.acmicpc.net/problem/10952
10952번: A+B - 5
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
while True:
a , b = map(int,input().split())
if a == 0 and b == 0:
break
else:
print(a + b)
코드 해석
https://holywat2r.tistory.com/115
[Python] 파이썬 while 반복문
1. while 반복문 * 조건이 참인 동안 계속 반복을 실행한다 a = 5 while a =! 0: print(a) a -= 1 5 4 3 2 1 * a 값이 5 이므로 while 문 조건 (0이 아닐경우)을 만족하므로 해당 반복문 실행 * 파이썬은 -- 나 ++..
holywat2r.tistory.com
while True: # 해당 반복문을 계속 실행
a , b = map(int,input().split()) # a, b 값을 받아들임
if a == 0 and b == 0: # a, b가 둘다 0 일경우 while문 탈출
break
else: # 그렇지 않다면 a + b 실행
print(a + b)
'Python > BOJ' 카테고리의 다른 글
[Python] 백준 1110 더하기 사이클 (0) | 2021.08.21 |
---|---|
[Python] 백준 10951 A + B - 4 (0) | 2021.08.21 |
[Python] 백준 10871 : X보다 작은 수 (0) | 2021.08.21 |
[Python] 합 (0) | 2021.08.11 |
[Python] A + B - 3 (0) | 2021.08.11 |