728x90
문제(https://www.acmicpc.net/problem/1000)
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
첫째 줄에 A와 B가 주어진다. (0 < A, B < 10)
첫째 줄에 A+B를 출력한다.
예제 입력 : 1 2
예체 출력 : 3
코드 1:
first, last = map(int, input().split())
print(f"{first+last}")
코드 2:
first, last = input().split()
print(f"{int(first)+int(last)}")
* 관련 문법 정리
https://yanadoo-coding.tistory.com/5
[ Python ] print( ) 2 (10718번, 10172번)
print 1)print("Hello word")은 print("Hello word", end='\n')와 같다 \n => 개행(enter) print("Hello world"여기) 여기에 특별한 값을 넣지 않으면 print문이 수행되고 끝에 \n(enter)가 들어간다. ex)print("H..
yanadoo-coding.tistory.com
'알고리즘 사이트 문제[Python] > 백준 알고리즘' 카테고리의 다른 글
백준 단계별로 풀어보기 - Hello World(2557번) with Python (0) | 2021.05.09 |
---|