{ "metadata": { "name": "", "signature": "sha256:1ec069370833cb9a1fa1103327dee70d70a9a5edc289ea5de6025252a98aaa89" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## [Python Programming for Biologists, Tel-Aviv University / 0411-3122 / Spring 2015](http://py4life.github.io/TAU2015/)\n", "# Homework 1\n", "\n", "## 1) Mendelian fruit\n", "Mr. Lendem is studying the genetics of odor in Guavas (_Psidium guajava_).He knows that the D gene, controlling odor, follows Mendelian inheritance so that DD Guavas have a strong typical smell, Dd plants have weaker smell and dd plants don't smell at all. \n", "\n", "Write a program that, given a number of Guava plants examined, will calculate and print the expected numbers of smelly, less smelly and non-smelly plants (according to the Mendelian 1:2:1 inheritance law). \n", "- Remember that the expected number of plants is an _integer_!\n", "![guavas](http://www.touilleur-express.fr/wp-content/guava.jpg)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "plants_num = 1600 # Replace with a value of your choice.\n", "\n", "smelly = \n", "less_smelly = \n", "non_smelly = \n", "\n", "print('Smelly:',smelly)\n", "print('Less smelly:',less_smelly)\n", "print('Non Smelly:',non_smelly)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2) Blood types\n", "Each individual has either blood type 'A', 'B', 'AB' or 'O'. \n", "Blood donations may be received from individuals with the same blood type, although 'AB' may receive all types and 'O' may donate to all types. \n", "\n", "Write a program that, given the blood types of two patients, prints whether the recepient may receive a blood donation from the donor. The program should print 'True' if a donation is possible, 'False' if it isn't, and 'Invalid input' if one of the blood types is not 'A', 'B', 'AB' or 'O' (only accept uppercase letters." ] }, { "cell_type": "code", "collapsed": false, "input": [ "recepient_blood_type = 'A' # Replace with a value of your choice.\n", "donor_blood_type = 'O' # Replace with a value of your choice.\n", "\n", "# Your code goes here\n" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 5 }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3) Lab manager\n", "In Dr. Dre's lab, there are X students, each uses Y Petri dishes a month, on average. At the begining of each month, the lab manager has to decide if he/she should order more dishes. Given the number of students (X), the average number of dishes they use per month (Y) and the number of dishes in stock (N), write a program that will make the decision, using the following rules: \n", "- If there are enough dishes for the coming __two__ months, do not order anything. \n", "- If there are enough dishes for the coming month, but not for two month, order the ammount required to complete a two-month stock.\n", "- If there aren't enough dishes for the coming month, complete a two month stock __and__ order another mont's stock for reserves.\n", "\n", "Print the total number of dishes that should be ordered." ] }, { "cell_type": "code", "collapsed": false, "input": [ "students = 1 # Replace with a value of your choice.\n", "dishes_per_student = 1 # Replace with a value of your choice.\n", "dishes_in_stock = 1 # Replace with a value of your choice.\n", "\n", "# your code here\n", "\n", "\n", "\n", "print('Order',dishes_to_order,'dishes')" ], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }