Complete the following function in python based on the cutomers request.
Function:
def hydrocarbon(hydrogen,carbon,oxygen):
#Add your code here
Customer Request:
take in three parameters assumed to be hydrogen, carbon, and oxygen IN THAT ORDER.
validate that all three values are non-negative integers:
if not than you should return None
if all three parameters are valid then you should calculate the mass of the hydrocarbon and return the mass where:
Each hydrogen has a molecular weight of 1.0079
Each carbon has a molecular weight of 12.011
Each oxygen has a molecular weight of 15.9994
For example:
hydrocarbon(4,3,0) will return 40.0646
hydrocarbon(1,2,3) will return 73.0281
hydrocarbon(-1,-1,-1) will return None
def hydrocarbon(hydrogen,carbon,oxygen):
if hydrogen < 0 or carbon < 0 or oxygen < 0:
return None
else:
return hydrogen * 1.0079 + carbon * 12.011 + oxygen * 15.9994
print(hydrocarbon(4,3,0))
print(hydrocarbon(1,2,3))
print(hydrocarbon(-1 , -1, -1))
Output:
$python3 main.py 40.0646 73.0281 None

Complete the following function in python based on the cutomers request. Function: def hydrocarbon(hydrogen,carbon,oxygen): #Add your...
5. (12 pts) A compound contains only carbon, hydrogen, and oxygen. If complete combustion of 70.86 g of this compound produces 103.9 g of CO2 and 42.52 g of H20, what is the molecular formula of this compound if it has a molar mass of 120.104 g/mol? (Carry each step to 3 digits after the decimal)
Create a python add the following functions below to the module. Each section below is a function that you must implement, make sure the function's names and parameters match the documentation (Copy-Paste). DO NOT put the functions in an if-name-main block. 1. def productSum(x: int, y: int, z: int) -> int This function should return: The product of x and y, if the product of x and y is less than z. Else it should return the sum of x...
python 2..fundamentals of python 1.Package Newton’s method for approximating square roots (Case Study 3.6) in a function named newton. This function expects the input number as an argument and returns the estimate of its square root. The script should also include a main function that allows the user to compute square roots of inputs until she presses the enter/return key. 2.Convert Newton’s method for approximating square roots in Project 1 to a recursive function named newton. (Hint: The estimate of...
PYTHON 3.6 Overview In this assignment we implement a class called TripleString. It consists of a few instance attribute and a few instance methods to support those attributes. In the next assignment, the TripleString class will help us create a more involved application. Before we do that though, we have to thoroughly test our TripleString implementation. Specifications The class TripleString will contain symbolic constants, instance attributes, and instance methods. ▶ Class symbolic constants This class has 3 symbolic constants, which...
Coding for Python - The pattern
detection problem – part 3: def
pattern_search_max(data_series, pattern, threshold)
Please do not use
'print' or 'input' statements.
Context of the assignment is:
In this assignment, your goal is to write a Python program to
determine whether a given pattern appears in a data series, and if
so, where it is located in the data series. Please see attachments
below:
We need to consider the following cases:
Case 1 - It is possible that the...
Do in Python please provide screenshots aswell.
Here are the requirements for your game: 1. The computer must select a word at random from the list of avail- able words that was provided in words.txt. The functions for loading the word list and selecting a random word have already been provided for you in ps3 hangman.py. 2. The game must be interactive; the flow of the game should go as follows: • At the start of the game, let the...
Coding for Python – don’t need it to be complex: In this assignment, your goal is to write a Python program to determine whether a given pattern appears in a data series, and if so, where it is located in the data series. This type of problem is common in many health disciplines. For example, identifying treatment pathways. The goal is to detect whether a certain pattern appears in the data series. In the following example, the pattern to be...
Complete function long_list_printer.print_list(). When it's
finished, it should be able to print this list,
a = [
[93, 80, 99, 72, 86, 84, 85, 41, 69, 31],
[15, 37, 58, 59, 98, 40, 63, 84, 87, 15],
[48, 50, 43, 68, 69, 43, 46, 83, 11, 50],
[52, 49, 87, 77, 39, 21, 84, 13, 27, 82],
[64, 49, 12, 42, 24, 54, 43, 69, 62, 44],
[54, 90, 67, 43, 72, 17, 22, 83, 28, 68],
[18, 12, 10,...
python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gradebook software to keep track of your grades. Some instructors like to calculate grades based on what is sometimes called a “total points” system. This is the simplest way to calculate grades. A student’s grade is the sum of the points earned on all assignments divided by the sum of the points available...
1. Which of the following are the sites within the human body where carbon dioxide and oxygen are exchanged? A. Alveoli B. Arteries C. Synapses D. Venules 2. Which of the following describes the most important reason for repeating an experimental investigation? A. To verify the validity of the original findings B. To expand upon the original investigation C. To manipulate the independent variable D. To attempt to disprove the hypothesis 3. Lithium has an atomic number of 3 and...