gpt4 book ai didi

python - 我一直在学习python 3.5,并试图获取一个字符串来转载用户输入的变量?

转载 作者:太空宇宙 更新时间:2023-11-04 03:05:59 28 4
gpt4 key购买 nike

print ("how old are you??"),
age = input()
print("How tall are you"),
height = input()
print("How much do you weigh"),
weight = input()

print("So, you're '%r' old, '%r' tall and weigh '%r' ") % ('age, height weight')

TypeError: %: 'NoneType' 和 'str 不支持的操作数类型

最佳答案

不要将变量放在引号中。而不是

print("So, you're '%r' old, '%r' tall and weigh '%r' ") % ('age, height weight')

print("So, you're '%r' old, '%r' tall and weigh '%r' " % (age, height weight))

关于python - 我一直在学习python 3.5,并试图获取一个字符串来转载用户输入的变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39460040/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com