Last active
December 17, 2020 19:07
-
-
Save ahmadali-jamali/115f109d690d58d1d28f63f6c13f1ae6 to your computer and use it in GitHub Desktop.
The statistical program which recognize smoker or nonsmoker of the person with percentage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Project Name : Smokermeter Program# | |
#2018 | |
#The Goal of the Project : This Programme predicts how many percent the person | |
#is tending to become a smoker or how many percent is smoker in life duration and she/he is smoker or not?! | |
############################################################################################################ | |
#Start : | |
#Input, name,make a feature_list: | |
if __name__ == '__main__': | |
feature_list=[] | |
print('Hi Welcome to the Smokermeter Programme this programme will predict that the person how many percent is tending to became a Smoker in life duration and is smoker on not!?.your should read the questions and answer') | |
name = str(input(' Please write your name : ' )) | |
print('Dear',name,'please read the questions and answer patiently') | |
#Inputs, qustions: | |
#Sex: | |
sex = str(input(' please write the gender of the person. for female sex type f and for male sex type m : ')) | |
#Age: | |
age = eval(input('Please enter age : ')) | |
#Married,Single,Divorce,Father or mather being | |
marital_status = str(input('If the person is single please write s an if is married wirte m : ')) | |
if marital_status=='s': | |
divorce = str(input('If the person is divorced please write yes, else write no : ')) | |
if marital_status=='m': | |
have_baby = str(input('If the person has a baby or babies please write yes else write no : ')) | |
divorce_baby = int(input('if the person was achilid of divorce enter 1 else enter 0 if you do not know this answer enter 0 :')) | |
if divorce_baby==1: | |
feature_list.append(divorce_baby*6) | |
#Smoker family and smokerfriends | |
Smoker_family = int(input('If in family there is a smoker person write 1 else write 0 : ')) | |
intimate_friends = int(input('Please write approximatly How many intimate friends does the person have : ')) | |
smoker_friends = eval(input('please between these friends how many of them use cigaret? ')) | |
smoker_freinds_percent = smoker_friends/intimate_friends | |
feature_list.append(smoker_freinds_percent*9) | |
sociable = int(input('between 1 to 10 which number you get to the person how many he or she is Sociable and how many contacts with other people: ')) | |
if sociable>=7: | |
feature_list.append(sociable*1.5+1.3) | |
else: | |
feature_list.append(sociable) | |
sportive = int(input('between 0 to 10 which number you get to the person how many he or she is Sportive : ')) | |
feature_list.append(-1*1.8*(sportive-10)) | |
#Drogs,Alcohol | |
Drogs = int(input('If the person has Drug addiction enter number 3 if just somteimes use it enter number 2 and if test that that enter 1 if do not use it enter 0 if you do not know this answer enter 0 : ')) | |
feature_list.append(Drogs*10) | |
Alcohol = int(input('If the person has Alcohol addiction enter number 2 if just sometimes use it enter number 1 if do not use it enter 0 if you do not know this answer also enter 1: ')) | |
feature_list.append(Alcohol*8) | |
#Health | |
mental_health = int(input('Between 1 to 10 how many do you score on mental health of the person normal is between 6 to 8 deprecion is between 0 to 5 : ')) | |
if mental_health <6: | |
feature_list.append((1/(mental_health**2))*25) | |
else: | |
feature_list.append(0) | |
fatty_liver = int(input('if the person has a Fatty Liver enter number one else enter number 0 : ')) | |
feature_list.append(fatty_liver*7) | |
tooth = int(input('if the person has lot of decayed teeths and dental plaque enter number 2 and if has a lot of dental plaque enter 1 else number 0 : ')) | |
feature_list.append(tooth*5) | |
stomach = float(input('if the person has a lot of stomachache enter 1.5 if somtimes has a stomach enter 1 else enter 0 : ' )) | |
feature_list.append(stomach*4) | |
cough = int(input('if the person has a Continuous cough enter nomber 1 else 0: ')) | |
feature_list.append(cough*10) | |
pulmonary_discomfort = int(input('if the person has a lot of Pulmonary discomfort enter number 2 if you dont know that enter 1 else 0: ')) | |
if pulmonary_discomfort !=0: | |
feature_list.append(pulmonary_discomfort*9) | |
if sex =='m': | |
mustache = int(input('if his mustache has a change colore enter number 1 if you dont know that plese enter 0 : ')) | |
if mustache == 1: | |
feature_list.append(mustache*9) | |
bruise_lip = int(input('if the person has a Bruise lip enter 1 else 0: ')) | |
feature_list.append(bruise_lip*9) | |
if sex=='m': | |
libido = int(input('if you know the person has low Libido enter number 1 else 0: ')) | |
feature_list.append(libido*6) | |
# This is a sagittal plot formula (y=ax^2) for age and gender with smoker percent(y): | |
# y=a(age-median of age)^2 + hight percent | |
#Conditions of the ages: | |
#This conditions are for female gender : | |
#For EX for This condition a=0.0554 and median is 26.5 and high percent is 12% | |
if age>=18 and age<=35 and sex == 'f' and marital_status == 's': | |
feature_list.append(-1*0.0554*(age-26.5)**2+12+smoker_freinds_percent*4+Smoker_family*2) | |
elif age>15 and age<=35 and sex == 'f' and marital_status=='m' and have_baby == 'no': | |
feature_list.append(-1*0.04*(age-25)**2+8+smoker_freinds_percent*1+Smoker_family*1) | |
elif age>=45 and sex == 'f' and marital_status == 'm' and have_baby == 'no': | |
feature_list.append(-1*0.003*(age-68)**2+10+smoker_freinds_percent*2+Smoker_family*1.9) | |
#For get percent with this conditions it used linear plot formula (y=ax+b) | |
if age>15 and sex == 'f' and marital_status == 'm' and have_baby == 'yes': | |
feature_list.append(-1*0.0357*(age-100)+smoker_freinds_percent*0.4) | |
elif sex == 'f' and divorce == 'yes' and have_baby == 'yes': | |
feature_list.append(-1*0.0714*(age-100)+smoker_freinds_percent*2+Smoker_family*1) | |
elif sex == 'f' and divorce == 'yes' and have_baby == 'no': | |
feature_list.append(0.06*age+10+smoker_freinds_percent*6+Smoker_family*2) | |
elif age<18 and age>5 and sex == 'f' and marital_status == 's' : | |
feature_list.append(0.235*age+1+smoker_freinds_percent*2+Smoker_family*1) | |
#This conditions are for male gender for this gender it used y=ax+b for get a percent : | |
if age>=17 and sex == 'm' and marital_status == 's': | |
feature_list.append(0.1*age+15+smoker_freinds_percent*7+Smoker_family*2.2) | |
elif age>15 and age<=35 and sex == 'm' and marital_status =='m' and have_baby == 'no': | |
feature_list.append(0.1*age+13+smoker_freinds_percent*5+Smoker_family*1.5) | |
elif age>=45 and sex == 'm' and marital_status == 'm' and have_baby == 'no': | |
feature_list.append(0.1*age+14+smoker_freinds_percent*6+Smoker_family*2) | |
elif age>15 and sex == 'm' and marital_status == 'm' and have_baby == 'yes': | |
feature_list.append(0.07*age+8+smoker_freinds_percent*3+Smoker_family*0.7) | |
elif sex == 'm' and divorce == 'yes' and have_baby == 'yes': | |
feature_list.append(0.1*age+15+smoker_freinds_percent*6+Smoker_family*2) | |
elif sex == 'm' and divorce == 'yes' and have_baby == 'no': | |
feature_list.append(0.1*age+16+smoker_freinds_percent*7+Smoker_family*2.5) | |
elif age<18 and age>5 and sex == 'f' and marital_status == 's' : | |
feature_list.append(0.323*age+1.5+smoker_freinds_percent*3+Smoker_family*1.2) | |
Sum_list = 0 | |
for i in range(len(feature_list)): | |
Sum_list = feature_list[i]+Sum_list | |
fw=open('smokermeter.txt','a') | |
Avrage = Sum_list/(len(feature_list)*10) | |
print('The person ',Avrage*100,'% is tending to become smoker.') | |
if Avrage>=0.6: | |
print('The person is so smoker .') | |
fw.write('The person is so smoker \n') | |
if Avrage>=0.45 and Avrage<0.6: | |
print('The person smokes usually. ') | |
fw.write('The person smokes usually \n') | |
if Avrage>=0.3 and Avrage<0.45: | |
print('The person uses sigaret somtimes but he is not Smoker . ') | |
fw.write('The person uses sigaret somtimes but he is not Smoker \n') | |
if Avrage>=0.25 and Avrage<0.3: | |
print('The person is not Smoker but probsble has been tested that. ') | |
fw.write('The person is not Smoker but probsble has been tested that \n') | |
if Avrage<0.25: | |
print('the person is not Smoker :') | |
fw.write('the person is not Smoker :\n') | |
fw.write('please type your comment here about the test and please send the txt file in this adress to improve the program : Ahmad_ali9371@yahoo.com \n') | |
fw.write('programmer Ahmadali.Jamali \n') | |
print('thanks for your comment and your intresting your result is in your destup and . wish the best.programmer :Ahmadali.jamali Ahmad_ali9371@yahoo.com \n ') | |
fw.write('-------------------------------------------------------------------------------------') | |
fw.close() | |
input() | |
#End of the Program | |
#programmer : Ahmadali.Jamali ahmad_ali9371@yahoo.com | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment