我必须创建一个使用毕达哥拉斯定理的程序,并且我必须验证输入。我在伪代码中被要求:
get Input()
1.1 initialize check
1.2 repeat check while check = true
1.3 input the length of 1st short side
1.4 return validated number
1.5 End repeat
到目前为止,我有
def MAIN():
print('This program is designed for the purpose of determining whether a triangle is right angled or not')
#This function is designed to take the input from the user.
def GET_INPUT():
input > 1
ShortSide1 = float(input('please enter the length of the first short side.')
while false:
print('invalid entry ')
else:
return ShortSide1
MAIN()
你被困在哪里了?换句话说,你需要帮助的是什么?
PS:我会使用raw_input而不是input,后者试图评估用户给出的输入。使用input(),您可以直接将代码输入到程序中。