我必须创建一个使用毕达哥拉斯'定理,我必须验证输入。我被问到伪代码:
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()
答案 0 :(得分:2)
PS: 我会使用raw_input而不是input,后者尝试评估用户给出的输入。使用input(),您可以将代码直接输入程序。