+ 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
13 Answers
+ 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)
+ 2
For BMI you should use if elif else logic
+ 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")
+ 1
And what about thisđ
+ 1
Ok thank u so much
+ 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)
+ 1
Thnk u
+ 1
I completed search engine
+ 1
PLZZ help me on bmi it's not working
+ 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)
+ 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)
+ 1
Thank u guys I completed it