Mini Calculator

A calculator is a simple and useful way to practice conditions and choosing an action from a string. Write a function basic_op that takes an operator operation and two numbers a and b. Return the result of the requested operation: addition, subtraction, multiplication, or integer division.

Примеры

Ввод
"+", 4, 7
Вывод
11
Ввод
"-", 15, 18
Вывод
-3
Ввод
"*", 5, 5
Вывод
25

Нужно реализовать

def basic_op(operation: str, a: int, b: int) -> int:

Теги

mathstrings
PostgreSQLv16
Entre para enviar

O resultado da execução do código aparecerá aqui

Visible tests
1
Input
"+", 4, 7
Expected11
2
Input
"-", 15, 18
Expected-3
3
Input
"*", 5, 5
Expected25
4
Input
"/", 49, 7
Expected7
5
Input
"+", 0, 0
Expected0
6
Input
"-", 15, 9
Expected6
Focus radio
Paused · SomaFM · Fluid