Advertisement
Guest User

Chem

a guest
Feb 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. c_molar_mass = 12.01
  2. h_molar_mass = 1.01
  3. n_molar_mass = 14.01
  4. o_molar_mass = 16.00
  5.  
  6. c = float(raw_input("Enter Carbon "))
  7. h = float(raw_input("Enter Hydrogen "))
  8. n = float(raw_input("Enter Nitrogen "))
  9. o = float(raw_input("Enter Oxygen "))
  10.  
  11. print "C - " + str(c) + " / " + str(c_molar_mass) + "g/mol"
  12. print "H - " + str(h) + " / " + str(h_molar_mass) + "g/mol"
  13. print "N - " + str(n) + " / " + str(n_molar_mass) + "g/mol"
  14. print "O - " + str(o) +  " / " + str(o_molar_mass) + "g/mol"
  15.  
  16. print "= " + str(round(c / c_molar_mass, 2)) + " mols C"
  17. print "= " + str(round(h / h_molar_mass, 2)) + " mols H"
  18. print "= " + str(round(n / n_molar_mass, 2)) + " mols N"
  19. print "= " + str(round(o / o_molar_mass, 2)) + " mols O"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement