User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 427,333 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,185 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums

Projects for the Beginner

Join Date: Aug 2005
Posts: 1,135
Reputation: Ene Uran is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 66
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Veteran Poster

Solution Re: Projects for the Beginner

  #40  
May 13th, 2006
Make a Molecular Weight calculator. The user enters for instance the formula for salt NaCl and the program looks up the atomic weight of sodium and chlorine and adds them up.

A dictionary with element:weight pairs would make it easy. You also have to design some kind of parser that figures out molecules like water H2O. Here you have to add up hydrogen twice and oxygen once.

Things get a little more challenging for the parser with toluene, since the user could enter C7H8 or C6H5CH3. Elements like silicon Si have to be entered that way and not as SI, since your parser would look at it as a combination of sulfur S and iodine I.

Since the right data is already there, you can expand the program to do elemental analysis, giving the percent of each element in the formula. Happy coding!
drink her pretty
Reply With Quote  
All times are GMT -4. The time now is 3:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC