我是Python编码的新手,我开始编写自己的程序。事情不起作用,我很难理解为什么。
我尝试将变量从global更改为class,将其更改为所有在阳光下仍然存在的bug。我也已经遍历了很多遍代码,但是我感觉好像只是在把随机的东西放在一起。
该代码应询问您的姓名,然后询问您的身高,体重,体型和鞋码。它应该为每个变量都提供一个函数,该函数要求用户提供其信息,然后在代码末尾应声明人员姓名,然后将其其他信息返回给他们。
你好,吉米!身高为5'6英寸,体重为180磅,衬衫大小为中,鞋子大小为10。
我的代码:
name = input('What Is your Name?')
print('Hello' + name + '!')
# This is the next part in the code
class Information:
global name1
name1 = Information()
height2 = Information()
weight3 = Information()
shirtSize4 = Information()
shoeSize5 = Information()
n = name1
h = height2
w = weight3
sh = shirtSize4
ss = shoeSize5
i=int
def n() : (h,w,sh,ss)
def h(): int(input('Please Enter Your Height'))
if h == i(4):
print("Please provide a Height larger than 4 feet")
else:
print(h)
def w() : i(input("Please Enter Your Weight in number of pounds, ex(100)"))
if w == i(90):
print("There is now way you're under 90 lbs. Please Enter A different weight")
def sh() : i(input("Please Enter your Shirt Size"))
def ss() : i(input("Please enter Your shoe size"))
if ss == i(3):
print('Please Enter a shoe size larger than an infant thank you.')
else:
print(ss)
#in the next line i'm trying to print out a string with variables
def print():
("Hello" + n + '! Your Height is' + h + "Your Weight is" + w + "Your Shirt-Size is"+ sh + "and your ShoeSize is" + ss)
结果:
What Is your Name?Zack
HelloZack!
<function h at 0x02D09C48>
<function ss at 0x02D09D20>
Process finished with exit code 0
这就是出现的内容,而不是输入的问题。