sh_07_ buy Apple's enhanced version

 

sh_07_ buy Apple's enhanced version

 

1  # 1 input monovalent Apple 
2 price_str = INPUT ( " Apple monovalent: " )
 . 3  
. 4  # 2. Enter apple wt 
. 5 weight_str = INPUT ( " Apple weight: " )
 . 6  
. 7  # 3. total payment calculation amount 
8  # Note: two strings between variables is not direct multiplication 
. 9  # Money = price_str weight_str * 
10  # . 1> converted into decimal price 
. 11 . price = a float (price_str)
 12 is  
13 is  # 2> is converted into weight decimal 
14 weight = a float (weight_str)
 15  
16  #3> The final amount is calculated with two decimal places 
. 17 Money. Price * = weight
 18 is  
. 19  Print (Money)

 

Guess you like

Origin www.cnblogs.com/shaohan/p/11465052.html