Calculation of the Index of Mc. Kynney (Index of Damage)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | # Created by Donyo Ganchev, Agricultural University, town of Plovdiv, Bulgaria
#donyo@abv.bg
choice=None
def IM():
num_0=input('Enter the number of plant parts with ball 0 (healthy): ')
num_1=input('Enter the number of plant parts with ball 1: ')
num_2=input('Enter the number of plant parts with ball 2: ')
num_3=input('Enter the number of plant parts with ball 3: ')
num_4=input('Enter the number of plant parts with ball 4: ')
sumi=num_1+(2*num_2)+(3*num_3)+(4*num_4)
sumg=num_0+num_1+num_2+num_3+num_4
mb=0.00
if num_1>0:
mb=1
if num_2>0:
mb=2
if num_3>0:
mb=3
if num_4>0:
mb=4
im=(float(sumi)/(sumg*mb))*100
print \
"""
"""
print "Index of Mc.Kynney: ", im
print "General number of plant parts: ", sumg
while choice!="0":
print \
"""
Index of Mc.Kynney Calculation Program
1 - Begin calculation
0 - Exit
"""
choice= raw_input("Choice: ")
if choice == "0":
exit()
elif choice=="1":
IM()
|