balance = 100
print('Current Balance: ', balance)
while balance > 0:
print('1. WITHDRAW')
print('2. DEPOSIT')
choice = input("Select an option... ")
if (choice == 1):
print('1')
elif (choice == 2):
print('2')
else:
print('test')
当我使用代码运行器扩展运行代码时,代码会显示在终端中,但是当它进入输入函数时,它会卡住,就像它要求我输入一些数据一样,但我无法输入数字或字母。
这是终端显示的...
[Running] python -u "c:\Users\bowen\Desktop\CSE 120\PROJECT 3\main.py"
Current Balance: 100
1. WITHDRAW
2. DEPOSIT
Select an option...
最佳答案
Code Runner 在 OUTPUT 中显示结果,默认情况下不接受输入。添加
"code-runner.runInTerminal": true
在Settings.json中,就可以输入数据了。
关于Python 输入函数在 VS 代码中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69186311/