migration from cloud service
This commit is contained in:
26
week4/ex3.py
Normal file
26
week4/ex3.py
Normal file
@@ -0,0 +1,26 @@
|
||||
def main():
|
||||
print('==Exercise 3==')
|
||||
flag=True
|
||||
while flag:
|
||||
a = input("pls input first side length:")
|
||||
try:
|
||||
a = float(a)
|
||||
flag=False
|
||||
except :
|
||||
print("pls input a float!")
|
||||
flag=True
|
||||
while flag:
|
||||
b = input("pls input another side length:")
|
||||
try:
|
||||
b = float(b)
|
||||
flag=False
|
||||
except :
|
||||
print("pls input a float!")
|
||||
|
||||
print(f"The lenth of the hypotenuse= {sum([i**2 for i in [a,b]])**0.5}")
|
||||
|
||||
print('==End Of Ex3==')
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user