1.Define a function named printMolecularWeight( nH, nC, nO ) which returns the weight of a molecule that consists of multiple atoms of Hydrogen (H), Carbon (C) and Oxygen (O). The number of atoms of H, C and O are given by the input parameters nH, nC and nO. Additionally, some chemistry knowledge tells us that single atom of Hydrogen weighs 1, a single atom of Carbon weighs 12 and a single atom of Oxygen weighs 16. For example the call printMolecularWeight( 2, 0, 1 ) should return 18 and the call printMolecularWeight( 1, 1, 3 ) should return 61.
2.Define a function named textFileAnalysis( filename ) which prints the following information about the words within a file - number of words that have length no more than 3, number of words of length between 4 and 7, number of words with length greater than 7. The name of the file is provided as input to the function through filename. For example if the file test.txt has the famous line "Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal." inside it, then textFileAnalysis('test.txt') should print "The input file has 13 words that have length no more than three, 13 words of length between four and seven and 4 words with length greater than seven".
3.Define a function named netProfitOrLoss( transactionList ) which prints the net profit or loss from a series of financial transactions. Each transaction can be either negative (which means it is a loss) or positive (which means it was a profit). The transactionList is a list of numbers given as input to the function. For example netProfitOrLoss( [10, -110, 75, -20, 40] ) should print "There was a net loss of $5". Another example: netProfitOrLoss( [33, 800, -300, 900, -1000, 650] ) should print "There was a net profit of $1083".
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
def printMolecularWeight(nH, nC, nO):
This is only a preview of the solution. Please use the purchase button to see the entire solution