Write a simple PYTHON script which determines the largest of five numbers.
You do a lot of comparing in your daily life. At the store you might compare the price and quality of two very similar products, for instance. Scientists also do a lot of comparing of things. One of the most basic types of scientific inquiry is to compare two groups. For instance, scientists many decades ago noticed that yellow mice tended to be more obese than white mice. To document this they took a large group of yellow mice and calulated their mean weight and did the same for a large group of white mice. This basic observation is interesting, but it begs the question: Why do the yellow mice tend to be more obese than other mice? As it turns out mice carry a gene called agouti on their second chromosome. This gene is most observably associated with coat color. There are many different forms of this gene (and many corresonding different coat colors which get expressed depending on which form of the gene an individual mouse happens to have inherited from its parents). Interestingly, one form of the gene, called viable yellow, is also associated with obesity in mice. (NOTE: Many genes influence obesity and coat color, but the agouti gene was one of the first to be associated with both obesity and coat color. Also, genes come in pairs: one inherited from the mother and the other from the father. We will discuss more about this in later units.)
Determining The Greatest of Two Values
In Python we can perform comparisons between two values. Consider the following short script:
Adding Comments
Often programmers add comments to a script in order to help them remember what the script is for and to explain tricky parts of a program. Comments are readable by humans, but the computer ignores them. Even though this is a really simple program we will add some comments to it anyways just so you can see what comments look like. You should notice that all comments begin with a # sign. (The bang line also begins with a #, but the computer does look at this line to know what to do with the script and the bang line is always the first line of a script whereas comments can be inserted anywhere - except for the first line.)
NOTE: The construct which is used to decide which value is larger may be slightly confusing to you.
|
ASSIGNMENT:
Write a script similar to the sample script which finds the largest of five values. You will need to perform a series of comparisons in order to get the right value stored in biggest.