Не могу понять,где ошибка в коде

yagaru

Новичок
Пользователь
Янв 16, 2021
14
1
3
Решил написать калькулятор. Выдает ошибку
Traceback (most recent call last):
File "main.py", line 1, in <module>
first = float(input('Введите первое число>>'))
EOFError: EOF when reading a line
Python:
first = float(input('Введите первое число>>'))
operation = input('Введите операцию>>')
second = float(input('Введите второе число>>'))
def calculated(first, operation, second):
    if operation == '+':
        result = first + second
        return result
    elif operation == '-':
        result = first - second
        return result
    elif operation == '*':
        result = first * second
        return result
    elif operation == '/':
        result = first / second
        return result
    else:
        return 'Ошибка'
        
        
def calculating(operations):
    print(calculated(first, operation, second))


def runner():
    calculating


#runner()
input()
Помогите пожалуйста)Уже час мучаюсь над этим
 

regnor

Модератор
Команда форума
Модератор
Июл 7, 2020
2 580
457
83
зачем эти 2 функции?
Python:
def calculating(operations):
    print(calculated(first, operation, second))


def runner():
    calculating
вот так работает
Python:
first = float(input('Введите первое число>>'))
operation = input('Введите операцию>>')
second = float(input('Введите второе число>>'))


def calculated(first, operation, second):
    if operation == '+':
        result = first + second
        return result
    elif operation == '-':
        result = first - second
        return result
    elif operation == '*':
        result = first * second
        return result
    elif operation == '/':
        result = first / second
        return result
    else:
        return 'Ошибка'

print(calculated(first, operation, second))
input()
 

yagaru

Новичок
Пользователь
Янв 16, 2021
14
1
3
зачем эти 2 функции?
Python:
def calculating(operations):
    print(calculated(first, operation, second))


def runner():
    calculating
вот так работает
Python:
first = float(input('Введите первое число>>'))
operation = input('Введите операцию>>')
second = float(input('Введите второе число>>'))


def calculated(first, operation, second):
    if operation == '+':
        result = first + second
        return result
    elif operation == '-':
        result = first - second
        return result
    elif operation == '*':
        result = first * second
        return result
    elif operation == '/':
        result = first / second
        return result
    else:
        return 'Ошибка'

print(calculated(first, operation, second))
input()
Спасибо)))
 

Форум IT Специалистов