python - 我想知道如何做到这一点,以便如果条件结束,代码在存款后不会停止,我该怎么做?(PYTHON)
问题描述
我想知道如何做到这一点,以便在 DEPOSIT if 条件结束后代码不会停止,而是 intead 循环回输入。我怎样才能在 Python 中做到这一点?
这是我的代码:
print("Welcome to Doge Bank")
print("How much money would you like to start with?")
balance = int(input())
print("Great! You can type DEPOSIT to DEPOSIT money, BAL to check your BALANCE and WITHDRAW to WITHDRAW money")
operation = input()
if operation == "DEPOSIT":
print("You have started a deposit operation, say Y to continue")
confirm = input()
if confirm == "Y":
print("How much would you like to deposit?")
depositNum = int(input())
balance = balance - depositNum
print("You have deposited", depositNum, "| Your current balance is", balance)
解决方案
推荐阅读
- flutter - 使用音频查询制作颤动的音乐应用程序,列表视图未显示
- c++ - 如何在没有 RtlInitUnicodeString 的情况下设置 PUNICODE_STRING?
- java - LibreOffice SDK 读取公式结果
- c# - 在 ASP.NET Core 5 中本地化数据注释错误消息中的标题
- kotlin - 如果 3 个输入中只有 1 个是正数,我如何打印一个真实的陈述?
- eclipse - Pydev 调试器错误 - NameError: name 'psort' is not defined
- prolog - 在 Prolog 中创建二叉树
- java - 如何使网页内容可供客户端下载
- javascript - 使用谷歌地球引擎中的图像集合计算归一化差
- python - 我自己的 KNN 函数给出的结果与 scikit-learn 不同