본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 13420번 사칙연산

by 현장 2022. 7. 4.

-Code

for _ in range(int(input())):
    s = input().split()
    a, b, c = int(s[0]), int(s[2]), int(s[4])
    x = s[1]
    if x == '+':
        res = a + b
    elif x == '-':
        res = a - b
    elif x == '*':
        res = a * b
    elif x == '/':
        res = a // b
    print("correct" if res == c else "wrong answer")