Main.Assignment2 History

Hide minor edits - Show changes to markup

February 05, 2013, at 06:51 PM MST by 24.54.128.180 -
Changed line 35 from:
   # code that 
to:
   # code that runs your functions
February 05, 2013, at 06:51 PM MST by 24.54.128.180 -
Changed lines 30-36 from:

Submit the programs by email to your instructor. At the top of each file put a comment that identifies you and the program (use a multi-line comment using triple quotes):

Assignment 2
Submitted by Your_Name
A short description of your program

to:

At the bottom of the program include code that runs the two functions. Your program should ask the user what they want to work on (sales or genomics), and according to their answer, prompts them for the input that is required for the sales/fold-change function, and then displays the result in a meaningful way (simply printing out the return value of the function is not that useful, since the user may not know what they mean). Put that code under a (:source lang=python:) if __name__ == _main_ :

   # code that 

(:sourceend:) statement as shown in class. Submit your code via ramCT. At the top of each file put a comment that identifies you and the program (use a multi-line comment using triple quotes):

(:source lang=python:) """Assignment 2 Submitted by Your_Name A short description of your program""" (:sourceend:)

February 05, 2013, at 06:36 PM MST by 24.54.128.180 -
Changed lines 3-4 from:

Due date: 2/8/10

to:

Due date: 2/15/13 at 5pm

This assignment has two parts. Each part will require you to write a function that accomplishes a given task. Put both functions in a single file called assignment2.py, which you will submit via ramCT.

Changed line 8 from:

A software company sells a package that retails for $99.

to:

Company X provides a discount for ordering in bulk quantities.

Changed lines 17-33 from:

Write a program called sales.py that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.

Instructions: Decompose the task into two sub-tasks - one that computes the discount, and one that computes the total amount.

Part 2 - BMI calculator

The body mass index (BMI) is often used to determine whether a person with a sedentary lifestyle is overweight or underweight for his or her height. A person's BMI is calculated with the following formula:

BMI = weight x 703 / (height * height)

where weight is measured in pounds and height is measured in inches. If a person's BMI is below 18.5, the person is considered underweight; a value between 18.5 and 25 is considered normal; a value above 25 is considered overweight. More information on BMI is found on the CDC website: http://www.cdc.gov/healthyweight/assessing/bmi/adult_bmi/.

Write a program called bmi.py that asks a person for their height and weight. It then prints their BMI and tells them if they are underweight, normal, or overweight. Use functions in order to decompose the task into subtasks - computing the BMI, and printing out the appropriate message given the value of the BMI.

to:

Write a function called cost(num_items, cost_per_item) that computes the cost to the customer given the number of items (num_items) and the cost per item (cost_per_item). The function should return the total cost and the discount they got.

Part 2 - log fold change

When comparing expression of a gene in two experimental conditions a biologist will typically be interested in genes that show differences in their level of expression. This is usually quantified by the ratio of expression values (fold-change) or its logarithm (log-fold-change). Typically a biologist will only investigate genes whose log-fold-change is above a certain threshold in absolute value. Write a function called log_fold_change(val1, val2, threshold) whose parameters are the expression levels of a gene in two experimental conditions. The function should return two values: the log-fold-change, where the log is base 2, and a Boolean value that indicates whether the log-fold-change is above 1 in absolute value.

Putting it all together

Changed line 36 from:

A short description of your program

to:

A short description of your program

February 01, 2010, at 12:53 PM MST by 129.82.44.241 -
Added lines 32-36:

Submit the programs by email to your instructor. At the top of each file put a comment that identifies you and the program (use a multi-line comment using triple quotes):

Assignment 2
Submitted by Your_Name
A short description of your program

January 31, 2010, at 09:46 AM MST by 71.196.160.210 -
Added lines 1-2:

Assignment 2

January 31, 2010, at 09:46 AM MST by 71.196.160.210 -
Added lines 1-2:

Due date: 2/8/10

Deleted lines 29-30:

You can find many

January 31, 2010, at 09:44 AM MST by 71.196.160.210 -
Added lines 1-29:

Part 1 - Software sales

A software company sells a package that retails for $99. Quantity discounts are given according to the following table:

QuantityDiscount
10-1920%
20-4930%
50-9940%
100 or more50%

Write a program called sales.py that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.

Instructions: Decompose the task into two sub-tasks - one that computes the discount, and one that computes the total amount.

Part 2 - BMI calculator

The body mass index (BMI) is often used to determine whether a person with a sedentary lifestyle is overweight or underweight for his or her height. A person's BMI is calculated with the following formula:

BMI = weight x 703 / (height * height)

where weight is measured in pounds and height is measured in inches. If a person's BMI is below 18.5, the person is considered underweight; a value between 18.5 and 25 is considered normal; a value above 25 is considered overweight. More information on BMI is found on the CDC website: http://www.cdc.gov/healthyweight/assessing/bmi/adult_bmi/.

Write a program called bmi.py that asks a person for their height and weight. It then prints their BMI and tells them if they are underweight, normal, or overweight. Use functions in order to decompose the task into subtasks - computing the BMI, and printing out the appropriate message given the value of the BMI.

You can find many