Welcome, guest | Sign In | My Account | Store | Cart

Quantitative Concentration Ratios Calculation Script

Python, 56 lines
 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
# Donyo Ganchev, Agricultural University, Plovdiv, Bulgaria
# donyo@abv.bg

choice=None

def qcr():

      gap=input('Enter general amount of pesticide: ')

      qr=raw_input('Enter quantitative ratios with colon between them: ')

      sqr=qr.split(':')

      fqr=[float(i) for i in sqr]

      sqr=sum(fqr)

      el_part=gap/sqr

      am_ratio=[el_part*x for x in fqr]

            

      print \

            """"

"""

      print "Calculated quantitative ratios are: " , am_ratio 

      

while choice!="0":

      print \

      """

     Calculation of quantitative concentration ratios

     1 - Begin calculation

     0 - Exit

     """

      choice= raw_input("Choice: ")

      if choice == "0":

                  exit()

      elif choice=="1":

             qcr()

1 comment

greg p 14 years, 11 months ago  # | flag

Looks interesting. I made it into an online utility here.

Created by donyo Ganchev on Fri, 8 May 2009 (MIT)
Python recipes (4591)
donyo Ganchev's recipes (11)

Required Modules

  • (none specified)

Other Information and Tasks