Не работает код(python 3) Code does't work(python3) | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 4

Не работает код(python 3) Code does't work(python3)

Написал код в виде калькулятора,я сам новичок поэтому код простой и я его проверил в других редакторах и он работает,но тут он не хочет работать так как должен и так как работает в других местах.Помогите пожалуйста! I wrote the code in the form of a calculator, I’m a beginner myself, so the code is simple and I checked it in other editors and it works, but here it doesn’t want to work as it should and as it works in other places. Help please! https://code.sololearn.com/cGLq2GsiG85d/?ref=app

12th Sep 2019, 10:24 AM
Danyysz
Danyysz - avatar
2 ответов
+ 2
This is just a problem on Sololearn, because there's no real interactive mode. https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
12th Sep 2019, 10:39 AM
HonFu
HonFu - avatar
- 2
while True: print("options") print("Enter 'add' to add two numbers") print("Enter 'subtract' to subtract two numbers") print("Enter 'multiply' to multiply two numbers") print("Enter 'divide' to divide two numbers") print("Enter 'quit' to end the program") user_input=input("") if user_input=="quit": break elif user_input=="add": num1=float(input("Enter a number:")) num2=float(input("Enter another number:")) result=str(num1+num2) print(result) elif user_input=="subtract": num1=float(input("Enter a number:")) num2=float(input("Enter another number:")) result=str(num1-num2) print(result) elif user_input=="multiply": num1=float(input("Enter a number:")) num2=float(input("Enter another number:")) result=str(num1*num2) print(result) elif user_input=="divide": num1=float(input("Enter a number:")) num2=float(input("Enter another number:")) result=str(num1/num2) print(result)
12th Sep 2019, 11:48 AM
Kamlesh Kumar
Kamlesh Kumar - avatar