0% found this document useful (0 votes)
24 views2 pages

Ai Exp 9 Source Code

The document contains a Python function for a Medical Diagnosis Expert System that interacts with users to assess symptoms. It asks a series of yes/no questions about common symptoms and provides potential diagnoses based on the responses. If the symptoms do not match any specific diagnosis, it advises consulting a doctor.

Uploaded by

seethas653
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Ai Exp 9 Source Code

The document contains a Python function for a Medical Diagnosis Expert System that interacts with users to assess symptoms. It asks a series of yes/no questions about common symptoms and provides potential diagnoses based on the responses. If the symptoms do not match any specific diagnosis, it advises consulting a doctor.

Uploaded by

seethas653
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Source Code:

def medical_diagnosis():
print("Welcome to the Medical Diagnosis Expert System")
print("Please answer the following questions with 'yes' or 'no'\n")

fever = input("Do you have a fever? ").lower()


cough = input("Do you have a cough? ").lower()
sore_throat = input("Do you have a sore throat? ").lower()
runny_nose = input("Do you have a runny nose? ").lower()
headache = input("Do you have a headache? ").lower()
body_ache = input("Do you have body aches? ").lower()

if fever == "yes" and cough == "yes" and body_ache == "yes":


print("\nDiagnosis: You may have the Flu.")
elif runny_nose == "yes" and sore_throat == "yes":
print("\nDiagnosis: You may have a Common Cold.")
elif fever == "yes" and headache == "yes" and sore_throat == "yes":
print("\nDiagnosis: You may have a Viral Infection.")
elif cough == "yes" and sore_throat == "yes" and fever == "no":
print("\nDiagnosis: You may have a Throat Infection.")
else:
print("\nDiagnosis: Symptoms are inconclusive. Please consult a doctor.")

medical_diagnosis()
Output:

You might also like