سلام دوستان من چند وقته چندتا برنامه داخل خود idle پایتون به درستی اجرا میشه ولی وقتی توی یک محیط دیگه مثل ویژوال استودیو کد رو تغییر میدم این ارور unexpected indent میده توی استک رفتم اما به نتیحه خاصی نرسیدم الان سورس bmi که با پایتون نوشتم میزارم از لحاظ اجرا اوکی بود و اجرا میشود اما داخل ویژوال استودیو ارور میده نظرتون چیه ؟ اصلا پایتون چرا این قدر به جایگاه دستورات حساس هست ؟
کد height = float(input('what is your height(meter): \n'))
weight = float(input('what is your wight body(kilogram): \n'))
age = int(input('what is your age : \n'))
def BMI(height, weight):
bmi = weight/(height**2)
return bmi
# Driver code
##height = 1.79832
##weight = 70
# calling the BMI function
bmi = BMI(height, weight)
print(f'the bmi is {bmi} with age {age}', "your body is ", end='') ##use round function
# Conditions to find out BMI category
if (bmi < 18.5):
print("underweight")
elif ( bmi >= 18.5 and bmi < 24.9):
print("Healthy")
elif ( bmi >= 24.9 and bmi < 30):
print("overweight")
elif ( bmi >=30):2.
print("Suffering from Obesity")
در مورد پروژه چندتا سوال دارم
inp1 = input('do you want to exit(y/n):')
if inp1=="y":
print ("exit by user")
while inp1 !="y":
height = float(input('what is your height(meter): \n'))
weight = float(input('what is your wight body(kilogram): \n'))
age = int(input('what is your age : \n'))
def BMI(height, weight):
bmi = weight / (height ** 2)
return bmi
# Driver code
##height = 1.79832
##weight = 70
# calling the BMI function
bmi = BMI(height, weight)
print(f'the bmi is {bmi} with age {age}', "your body is ", end='') ##use round function
# Conditions to find out BMI category
if (bmi < 18.5):
print("underweight")
elif (bmi >= 18.5 and bmi < 24.9):
print("Healthy")شاید پاسخ شما همینجا باشد