print('請輸入兩個數字')
while True:
c=input('\nthe first number: ')
if c=='q':
break
b=input('\nthe second number')
try:
suma=float(c)+float(b)
except ValueError:
print('please enter numbers!')
else:
print(suma)
為什么運行這個的話是一直提示我輸入數字 而沒有進行計算啊
uj5u.com熱心網友回復:
print('請輸入兩個數字')
while True:
c=input('\nthe first number: ')
if c=='q':
break
b=input('\nthe second number: ')
try:
suma=float(c)+float(b)
except ValueError:
print('please enter numbers!')
else:
print(suma)注意代碼縮進
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/155759.html
上一篇:Flume實時監控 單個追加檔案
