|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Hard-Ass Python \n", |
| 8 | + "\n", |
| 9 | + "Here we will do everything we can to code as hell. \n", |
| 10 | + "\n", |
| 11 | + "Yes, with our hands until we have a solid grasp on Python.\n" |
| 12 | + ] |
| 13 | + }, |
| 14 | + { |
| 15 | + "cell_type": "markdown", |
| 16 | + "metadata": {}, |
| 17 | + "source": [ |
| 18 | + "## Variables and Names " |
| 19 | + ] |
| 20 | + }, |
| 21 | + { |
| 22 | + "cell_type": "code", |
| 23 | + "execution_count": 1, |
| 24 | + "metadata": { |
| 25 | + "collapsed": true |
| 26 | + }, |
| 27 | + "outputs": [], |
| 28 | + "source": [ |
| 29 | + "cars = 100\n", |
| 30 | + "space_in_car = 4.0\n", |
| 31 | + "drivers = 30\n", |
| 32 | + "passengers = 100\n", |
| 33 | + "cars_not_driving = cars - drivers\n", |
| 34 | + "cars_driving = drivers\n", |
| 35 | + "carpool_capacity = cars_driving*space_in_car\n", |
| 36 | + "avg_passengers_per_car = passengers / cars_driving\n" |
| 37 | + ] |
| 38 | + }, |
| 39 | + { |
| 40 | + "cell_type": "code", |
| 41 | + "execution_count": 5, |
| 42 | + "metadata": {}, |
| 43 | + "outputs": [ |
| 44 | + { |
| 45 | + "name": "stdout", |
| 46 | + "output_type": "stream", |
| 47 | + "text": [ |
| 48 | + "There are 100 cars available to you!\n", |
| 49 | + "There are only 30 drivers available.\n", |
| 50 | + "There will be 70 empty cars today.\n", |
| 51 | + "We can take 120.0 people today\n", |
| 52 | + "Today we hacve 100 to carpool!\n", |
| 53 | + "We need to put approximately 3.3333333333333335 in each car.\n" |
| 54 | + ] |
| 55 | + } |
| 56 | + ], |
| 57 | + "source": [ |
| 58 | + "# Now lets print our logic we just came up with...\n", |
| 59 | + "\n", |
| 60 | + "print(\"There are\", cars, \"cars available to you!\")\n", |
| 61 | + "print(\"There are only\", drivers, \"drivers available.\")\n", |
| 62 | + "print(\"There will be\", cars_not_driving, \"empty cars today.\")\n", |
| 63 | + "print(\"We can take\", carpool_capacity, \"people today\")\n", |
| 64 | + "print(\"Today we hacve\", passengers, \"to carpool!\")\n", |
| 65 | + "print(\"We need to put approximately\", avg_passengers_per_car, \"in each car.\")" |
| 66 | + ] |
| 67 | + }, |
| 68 | + { |
| 69 | + "cell_type": "markdown", |
| 70 | + "metadata": {}, |
| 71 | + "source": [ |
| 72 | + "##### Wait a minute, how can you put 3.33 people in each car\n", |
| 73 | + "\n", |
| 74 | + "Exercise 1 : Round this number off, will you!" |
| 75 | + ] |
| 76 | + }, |
| 77 | + { |
| 78 | + "cell_type": "code", |
| 79 | + "execution_count": null, |
| 80 | + "metadata": { |
| 81 | + "collapsed": true |
| 82 | + }, |
| 83 | + "outputs": [], |
| 84 | + "source": [] |
| 85 | + } |
| 86 | + ], |
| 87 | + "metadata": { |
| 88 | + "kernelspec": { |
| 89 | + "display_name": "Python 3", |
| 90 | + "language": "python", |
| 91 | + "name": "python3" |
| 92 | + }, |
| 93 | + "language_info": { |
| 94 | + "codemirror_mode": { |
| 95 | + "name": "ipython", |
| 96 | + "version": 3 |
| 97 | + }, |
| 98 | + "file_extension": ".py", |
| 99 | + "mimetype": "text/x-python", |
| 100 | + "name": "python", |
| 101 | + "nbconvert_exporter": "python", |
| 102 | + "pygments_lexer": "ipython3", |
| 103 | + "version": "3.6.1" |
| 104 | + } |
| 105 | + }, |
| 106 | + "nbformat": 4, |
| 107 | + "nbformat_minor": 2 |
| 108 | +} |
0 commit comments