I need help in Python for Beginners | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need help in Python for Beginners

I CANT SEEM TO FIND THE SOLUTION FOR THE BMI CALCULATOR. SORRY IF EVERYTHING IS IN CAPSLOCK.

28th Feb 2021, 12:28 AM
George
11 Answers
+ 1
Your code seems to have a lots of errors weight = float(input()) Same with height height = float(input()) Put the height**2 in parentheses like this: (height**2) edit: sorry for the parentheses correction, I am only wrong 😕😅
28th Feb 2021, 2:14 AM
∆BH∆Y
∆BH∆Y - avatar
+ 7
∆BH∆Y is right (except you don't need parentheses around height**2 because exponentiation is evaluated before division)
28th Feb 2021, 2:06 AM
David Ashton
David Ashton - avatar
+ 1
not everything is capslock: question title and tag are not... so you don't have any excuse for that... (and even all caps, that's not a good excuse at all... how could you code if you have capslock blocked ^^)
28th Feb 2021, 12:32 AM
visph
visph - avatar
+ 1
ty but it says that there is a syntax error in where it says elif bmi >= 18.5 and < 25
28th Feb 2021, 2:11 AM
George
+ 1
Thank you guys all so much for helping me!
28th Feb 2021, 2:17 AM
George
+ 1
George You just have to add the same variable to second condition after the 'and'. For Example: 🔹elif bmi >= 18.5 and < 25: # Should Be 🔹elif bmi >= 18.5 and bmi < 25: ________________________________ weight = int(input()) height = float(input()) bmi = weight / height**2 if bmi < 18.5: print("Underweight") elif bmi >= 18.5 and bmi < 25: primt("Normal") elif bmi >= 25 and bmi < 30: print("Overweight") else bmi >= 30: print("Obesity") ________________________________
28th Feb 2021, 2:58 AM
noteve
noteve - avatar
0
for some reason when i wrote the body of my question everything was capitalised
28th Feb 2021, 1:08 AM
George
0
ok weight = input(int()) height = input(float()) bmi = weight / height**2 if bmi < 18.5: print("Underweight") elif bmi >= 18.5 and < 25: primt("Normal") elif bmi >= 25 and < 30: print("Overweight") else bmi >= 30: print("Obesity")
28th Feb 2021, 1:27 AM
George
0
ok ill take a look at it
28th Feb 2021, 2:14 AM
George
0
Help the python ?? No one likes homework, but your math teacher has given you an assignment to find the sum of the first N numbers. Let’s save some time by creating a program to do the calculation for you! Take a number N as input and output the sum of all numbers from 1 to N (including N). Sample Input 100 Sample Output 5050 Explanation: The sum of all numbers from 1 to 100 is equal to 5050
1st Mar 2021, 10:30 AM
ilyass nafi
ilyass nafi - avatar
- 2
Help plis
1st Mar 2021, 7:11 PM
ilyass nafi
ilyass nafi - avatar