小编Gar*_*ney的帖子

如何在python中的输入字段后面添加文本?

在 python 中,如果我想让某人以美元输入贷款金额,我可以编写如下代码:

# Loan amount
L = float(input("Enter the loan amount: $"))
Run Code Online (Sandbox Code Playgroud)

但如果我想要的话,比如说利率,它是一个百分比。如果我编码:

# Interest rate
I = float(input("Enter the interest rate: "))
Run Code Online (Sandbox Code Playgroud)

我怎样才能让百分号 % 在他们输入的内容后显示出来?

python input

6
推荐指数
1
解决办法
4277
查看次数

标签 统计

input ×1

python ×1