Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
Text =input() Word =input() If word in text: Print('word found') Else: Print('word not found')
16th Jan 2022, 2:26 PM
Timur Askarov
Timur Askarov - avatar
+ 3
While ((weight / height) < 18.5):
17th Jan 2022, 4:50 AM
Atharv127
Atharv127 - avatar
+ 2
there is space in line three that is giving error but I suggest that use if/elif in the place of while because this code will print infinite loop.
17th Jan 2022, 6:01 AM
Shailendra Kumar
Shailendra Kumar - avatar
+ 1
Sajjad Note: Python uses spaces (or tabs) to separate a block of code from another, unlike C++ and Java which use braces to do so. You need to make sure that you've indented the code right.
18th Jan 2022, 2:01 AM
Œ ㅤ
Œ ㅤ - avatar
+ 1
There is unnecessary indentation block in line 3 ..and need intended block in line 4 ,6,8,10..I suggest to use if and elif for this code
18th Jan 2022, 5:06 AM
Sujata Mitkari
Sujata Mitkari - avatar
+ 1
while( (weight / height)<18.5);
18th Jan 2022, 6:17 AM
Nitin Sangal
Nitin Sangal - avatar
+ 1
Use if else statement not while
18th Jan 2022, 9:32 AM
SK SANOWAR
+ 1
I think the possible errors might be: 1. Indentation error. 2.you should a add a colon(:) after while loop 3. put () around 'weight/height'
18th Jan 2022, 12:34 PM
Musharraf
Musharraf - avatar
0
Where you have written while you should use if, elif or else. Now you have build yourself a loop.
16th Jan 2022, 12:50 PM
Paul
Paul - avatar
0
How can I fix it
16th Jan 2022, 12:53 PM
Sajjad
Sajjad - avatar
0
height = float(input()) weight = int(input()) if weight/height < 18.5: print("underweight") elif weight/height**2 >= 18.5 <25: print("normal") elif weight/height**2 >= 25 < 30: print("overweight") elif weight/height**2 >= 30: print("obesity")
16th Jan 2022, 12:55 PM
Sajjad
Sajjad - avatar
0
This also contains error
16th Jan 2022, 12:55 PM
Sajjad
Sajjad - avatar
0
It is better, but you should only indent the lines after if and elif. Like this: height = float(input()) weight = int(input()) if weight/height**2 < 18.5: print("underweight")
16th Jan 2022, 12:59 PM
Paul
Paul - avatar
0
The error is "Invalid literal for int()" What should I do
16th Jan 2022, 1:18 PM
Sajjad
Sajjad - avatar
0
The input for weight should be first, then you should ask for heigth.
16th Jan 2022, 1:27 PM
Paul
Paul - avatar
0
weight = int(input()) height = float(input()) check_bmi = round (weight / (height **2)) if check_bmi < 18.5: print("Underweight") elif check_bmi >= 18.5 and check_bmi < 25: print("Normal") elif check_bmi >= 25 and check_bmi < 30: print("Overweight") elif check_bmi >= 30: print("Obesity")
16th Jan 2022, 1:39 PM
Sajjad
Sajjad - avatar
0
Now it has error again 😭
16th Jan 2022, 1:40 PM
Sajjad
Sajjad - avatar
0
You’re working on a search engine. Watch your back Google! The given code takes a text and a word as input and passes them to a function called search(). The search() function should return "Word found" if the word is present in the text, or "Word not found", if it’s not. Sample Input "This is awesome" "awesome" Sample Output Word found
16th Jan 2022, 1:46 PM
Sajjad
Sajjad - avatar
0
Could you help me with this
16th Jan 2022, 1:46 PM
Sajjad
Sajjad - avatar
0
Watch your bracket on the while statment
17th Jan 2022, 11:36 AM
Eneghalu Kosisochukwu
Eneghalu Kosisochukwu - avatar