【发布时间】:2022-12-14 02:55:25
【问题描述】:
我正在尝试从用户那里获取公斤数并使用以下代码将其转换为磅数:
`
kg = input("How many kg?")
lbs = kg * 2.2
print(lbs)
`
That code produces a following error:
追溯(最近一次通话): 文件“/Users/nikitalutsai/PycharmProjects/pythonProject 1/exercise.py”,第 2 行,在 磅 = 公斤 * 2.2 TypeError:无法将序列乘以“float”类型的非整数
I expect pounds to be converted from kg. How can i get the kilograms from the user and convert them to pounds?
【问题讨论】:
标签: python python-3.10