日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python错误修复_如何修复python错误(对象不可调用)

發(fā)布時間:2023/12/19 python 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python错误修复_如何修复python错误(对象不可调用) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

所以我現(xiàn)在正在學(xué)習(xí)Python,我編寫了以下代碼來練習(xí):import time

from decimal import Decimal

name = input("\nPlease enter your name: ")

def bmi(weight, height):

bmi = weight/(height**2)

if bmi > 29.9:

report = "obese"

elif bmi <= 29.9 and bmi > 24.9:

report = "overweight"

elif bmi <= 24.9 and bmi > 18.5:

report = "normal"

elif bmi <= 18.5:

report = "underweight"

else:

report = "to be lying"

return (bmi, report)

while True:

weight = Decimal(input("\nEnter your weight (kg): "))

if weight == 0:

print("You can't have a weight of 0. Try again!")

continue

if weight < 0:

print("A negative weight? Really?")

continue

height = Decimal(input("Enter your height (cm): "))

height = height/100

bmi, report = bmi(weight, height)

bmi = round(bmi, 1)

time.sleep(1)

print("\n" + name.title() + ", according to your BMI (" + str(bmi) +

"), you are considered " + report + ".")

qprompt = input("\nDo you wish to quit? (y/n): ")

if qprompt == 'y':

break

else:

continue

在while循環(huán)再次開始并且我輸入了一個權(quán)重和高度之后,這段代碼似乎返回了一個錯誤。它第一次運行良好,但在我告訴它繼續(xù)運行,然后輸入重量和高度后,它崩潰并給出以下錯誤:

^{pr2}$

我想我應(yīng)該在這里尋求幫助,因為我無法解決問題。

謝謝!在

總結(jié)

以上是生活随笔為你收集整理的python错误修复_如何修复python错误(对象不可调用)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。