+ 1

In python for beginners this 2 project are not compleyes bmi and search engine I coded correctly but all time they show wrong

text = input() word = input() def search(text,word): if word in text: print("Word found") else: print("Word not found") print(search(text,word))....this is code of search engine

28th May 2021, 4:24 AM
shobhana sisode
shobhana sisode - avatar
13 Réponses
+ 2
You should return from the function instead of printing it text = input() word = input() def search(text,word): if word in text: return "Word found" else: return "Word not found" print(search(text,word)) or text = input() word = input() def search(text,word): if word in text: print("Word found") else: print("Word not found") search(text,word)
28th May 2021, 4:25 AM
Ayush Kumar
Ayush Kumar - avatar
+ 2
For BMI you should use if elif else logic
28th May 2021, 4:27 AM
Ayush Kumar
Ayush Kumar - avatar
+ 1
weight = int(input()) height = float(input()) bmi = weight / (height*height) if bmi < 18.5: print("underweight") if bmi >= 18.5 and bmi < 25: print("normal") if bmi >= 25 and bmi < 30: print("overweighted") if bmi > 30: print("obesity")
28th May 2021, 4:26 AM
shobhana sisode
shobhana sisode - avatar
+ 1
And what about this🖕
28th May 2021, 4:27 AM
shobhana sisode
shobhana sisode - avatar
+ 1
Ok thank u so much
28th May 2021, 4:28 AM
shobhana sisode
shobhana sisode - avatar
+ 1
Just Try This Code text = input("Enter Your Text : ") word = input("Enter Your Word To Find : ") text = text.split() def search(text,word): if word in text: print("Word found") else: print("Word not found") search(text,word)
28th May 2021, 4:32 AM
Tirthen Patel
Tirthen Patel - avatar
+ 1
Thnk u
28th May 2021, 4:33 AM
shobhana sisode
shobhana sisode - avatar
+ 1
I completed search engine
28th May 2021, 4:33 AM
shobhana sisode
shobhana sisode - avatar
+ 1
PLZZ help me on bmi it's not working
28th May 2021, 4:36 AM
shobhana sisode
shobhana sisode - avatar
+ 1
BMI : Type = int(input('''In What Type Of Unit You Want. For Kg And Meters - 1 For Lbs And Inches - 2 ''')) Weight = float(input("Enter Your Weight : ")) Height = float(input("Enter Your Height : ")) def BMI(Height,Weight) : if Type == 1 : BMI = Weight / (Height**2) print("Your Weight Is " , Weight , " Kg" ) print("Your Height Is " , Height , " M" ) print("Your BMI Is " , BMI , " Kg/M^2") elif Type == 2 : BMI = 703 * Weight / (Height**2) print("Your Weight Is " , Weight , " Lbs" ) print("Your Height Is " , Height , " Inches" ) print("Your BMI Is " , BMI , " Lbs/Inches^2") else : print("Invalid Input") BMI(Height,Weight) def Answer(BMI) : if BMI < 18.5 : print("You Are UNDERWEIGHT ") elif 18.6 < BMI < 24.9 : print("You Are NORMAL ") elif 25 < BMI < 29.9 : print("You Are OVERWEIGHT ") elif 30 < BMI < 34.9 : print("You Are OBESE ") elif BMI > 34 : print("You Are EXTREMLY OBESE ") Answer(BMI)
28th May 2021, 4:52 AM
Tirthen Patel
Tirthen Patel - avatar
+ 1
text = input() text = text.split() word = input() def search(text,word):     if word in text:         print("Word found")     else:         print("Word not found")         search(text,word)
28th May 2021, 4:01 PM
Evandro Simorangkir
Evandro Simorangkir - avatar
+ 1
Thank u guys I completed it
28th May 2021, 4:35 PM
shobhana sisode
shobhana sisode - avatar