T
T
Temirkhan202020-05-17 20:13:28
Python
Temirkhan20, 2020-05-17 20:13:28

Error: ''Name 'c' is not defined''. Why is that?

Gives an error:
Traceback (most recent call last):
File "/Users//Desktop/Python/file2.py", line 10, in
print ("Result: " + str(c))
NameError: name 'c' is not defined

Variable ''c'' is non-Russian, checked.

what = input('Что делаем? (+,-):' )

a = float(input ("Введи первое число: "))
b = float(input ("Введи второе число: "))

if what == "+":
    с = a + b
    print ("Результат: " + str(c))
elif what == "-":
    с = a - b 
    print ("Результат: " + str(c))
else :
    print ("Выбрана неверная операция!")

There was an idea to set the value of ''c'' at the very beginning, since he does not recognize it, but
I do not understand how to set it to a double value so that he calculates the calculator without errors.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-05-17
@Temirkhan20

Latin and Cyrillic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question