|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "8fdc0282-e0c7-4399-ae1e-35c8862df679", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# Workshop 1 - Module Overview and Introduction to Python\n", |
| 9 | + "\n", |
| 10 | + "Welcome to Data Programming in Python! This module will introduce you to the Python programming language - from variables and if statements to statistical testing and graph plotting - with the aim of preparing you for the other modules on the course and handling data in a work setting. **No need to be shy - if you need help, just ask for it!**\n", |
| 11 | + "\n", |
| 12 | + "- [Jupyter Notebook](#Jupyter-Notebook)\n", |
| 13 | + "- [Variables](#Variables)\n", |
| 14 | + " - [Data Types and Operators](#Data-Types-and-Operators)\n", |
| 15 | + " - [Basic Data Types](#Basic-Data-Types)\n", |
| 16 | + " - [Collection Data Types](#Collection-Data-Types)" |
| 17 | + ] |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "markdown", |
| 21 | + "id": "8832cbbd-139b-44c9-9260-eae1f443591e", |
| 22 | + "metadata": {}, |
| 23 | + "source": [ |
| 24 | + "## Jupyter Notebook\n", |
| 25 | + "First - since we'll be using it for both the lectures and workshops - let's take a quick look at how Jupyter Notebook works.\n", |
| 26 | + "\n", |
| 27 | + "A Jupyter Notebook is made up of \"cells\". There are two primary types of cells you need to know about.\n", |
| 28 | + "\n", |
| 29 | + "The cell you are currently reading from is called a markdown cell, it contains text written in a syntax called markdown that - when the cell is ran - produces formatted text (including headers, table of contents, etc). Try double clicking this cell (or any other markdown cell) to see the raw un-rendered cell contents. Feel free to experiment with the cell's contents!\n", |
| 30 | + "\n", |
| 31 | + "The following cell is a \"code cell\", with the cell highlighted the code within - which is Python code - can be executed using shift+enter or by selecting Run -> Run Selected Cell on the top menu bar." |
| 32 | + ] |
| 33 | + }, |
| 34 | + { |
| 35 | + "cell_type": "code", |
| 36 | + "execution_count": null, |
| 37 | + "id": "401f497c-67cd-47e8-af0c-04f6fb90e2a9", |
| 38 | + "metadata": {}, |
| 39 | + "outputs": [], |
| 40 | + "source": [ |
| 41 | + "# This is a code cell.\n", |
| 42 | + "\n", |
| 43 | + "1 + 2" |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "cell_type": "markdown", |
| 48 | + "id": "d4704e9a-0eaf-4e80-97bd-90c24c92b7c9", |
| 49 | + "metadata": {}, |
| 50 | + "source": [ |
| 51 | + "As you can see, when the cell is executed, the output of the code appears below the cell (if there is a valid output). The line prefixed with a hash symbol (#) is not executed as, in Python, this is a comment line used for labeling your code. In your assignments, you can use it to reference any snippets used!\n", |
| 52 | + "\n", |
| 53 | + "You can also see a simple addition of two values being executed (1 + 2) and the result being displayed, but we don't \"save\" these values in any way for later use. In the cell above, modify the arithmetic statement - maybe try using multiplication or division instead. What happens if you try to divide by zero?\n", |
| 54 | + "\n", |
| 55 | + "Very often, you'll want to store a value for use later in the code. This is where variables come in handy!" |
| 56 | + ] |
| 57 | + }, |
| 58 | + { |
| 59 | + "cell_type": "markdown", |
| 60 | + "id": "abd43683-5a93-479a-b7c9-1f207ff8eb8d", |
| 61 | + "metadata": {}, |
| 62 | + "source": [ |
| 63 | + "## Variables\n", |
| 64 | + "\n", |
| 65 | + "A variable is a piece of computer memory containing some information which has been assigned a symbolic name as part of your code.\n", |
| 66 | + "\n", |
| 67 | + "Here's an example:\n" |
| 68 | + ] |
| 69 | + }, |
| 70 | + { |
| 71 | + "cell_type": "code", |
| 72 | + "execution_count": null, |
| 73 | + "id": "7f24c21b-96bf-4022-a570-84ad90e938dc", |
| 74 | + "metadata": {}, |
| 75 | + "outputs": [], |
| 76 | + "source": [ |
| 77 | + "add_sum = 1 + 2" |
| 78 | + ] |
| 79 | + }, |
| 80 | + { |
| 81 | + "cell_type": "markdown", |
| 82 | + "id": "26695d2a-f33d-4ad6-a12a-20ba2b13b706", |
| 83 | + "metadata": {}, |
| 84 | + "source": [ |
| 85 | + "Here we've declared a variable, with the symbolic name \"add_sum\", that contains the value of 1 + 2.\n", |
| 86 | + "\n", |
| 87 | + "When declaring a variable, you should ensure that the symbolic name is representative of what the assigned value represents. You should try to adhere to the [PEP8 style guide](https://peps.python.org/pep-0008/#function-and-variable-names) when declaring your variables (they should be lowercase, with words separated by underscores as necessary to improve readability).\n", |
| 88 | + "\n", |
| 89 | + "Try creating a variable in the code cell above that stores the result of some calculation using more values - maybe try to involve other arithmetic operators (multiply, divide, subtract)!" |
| 90 | + ] |
| 91 | + }, |
| 92 | + { |
| 93 | + "cell_type": "code", |
| 94 | + "execution_count": null, |
| 95 | + "id": "a343c6dd-a29c-4971-83d8-c8bcdf274bee", |
| 96 | + "metadata": {}, |
| 97 | + "outputs": [], |
| 98 | + "source": [ |
| 99 | + "dog_name = 'Woofers'\n", |
| 100 | + "owner_name = 'Steven'\n", |
| 101 | + "years_adopted = 4" |
| 102 | + ] |
| 103 | + }, |
| 104 | + { |
| 105 | + "cell_type": "markdown", |
| 106 | + "id": "18301f4a-5243-4fdc-9529-2ef239e2111e", |
| 107 | + "metadata": {}, |
| 108 | + "source": [ |
| 109 | + "Here's some more variables. You'll notice that, when we ran the code cells, no output values were displayed. We are only declaring variables and assigning values to them, as covered in the lecture; we need to call a variable to see its value." |
| 110 | + ] |
| 111 | + }, |
| 112 | + { |
| 113 | + "cell_type": "code", |
| 114 | + "execution_count": null, |
| 115 | + "id": "c5efab9a-1e52-45fa-9da8-7fdd269e3abc", |
| 116 | + "metadata": {}, |
| 117 | + "outputs": [], |
| 118 | + "source": [ |
| 119 | + "add_sum" |
| 120 | + ] |
| 121 | + }, |
| 122 | + { |
| 123 | + "cell_type": "code", |
| 124 | + "execution_count": null, |
| 125 | + "id": "83faef36-a6a6-480a-85dd-38719b39eb9e", |
| 126 | + "metadata": {}, |
| 127 | + "outputs": [], |
| 128 | + "source": [ |
| 129 | + "dog_name" |
| 130 | + ] |
| 131 | + }, |
| 132 | + { |
| 133 | + "cell_type": "code", |
| 134 | + "execution_count": null, |
| 135 | + "id": "924c01e3-80a0-47c7-a45f-2eb946e5a6e2", |
| 136 | + "metadata": {}, |
| 137 | + "outputs": [], |
| 138 | + "source": [ |
| 139 | + "owner_name" |
| 140 | + ] |
| 141 | + }, |
| 142 | + { |
| 143 | + "cell_type": "code", |
| 144 | + "execution_count": null, |
| 145 | + "id": "bab03cd5-b71f-4b04-bfdb-9f488f9b1325", |
| 146 | + "metadata": {}, |
| 147 | + "outputs": [], |
| 148 | + "source": [ |
| 149 | + "years_adopted" |
| 150 | + ] |
| 151 | + }, |
| 152 | + { |
| 153 | + "cell_type": "markdown", |
| 154 | + "id": "876f2ea1-720f-4968-aa46-7491690290a5", |
| 155 | + "metadata": {}, |
| 156 | + "source": [ |
| 157 | + "There we go. The above was an example using numbers, but what else exists in Python and what else can we assign to variables?" |
| 158 | + ] |
| 159 | + }, |
| 160 | + { |
| 161 | + "cell_type": "markdown", |
| 162 | + "id": "ac79e737-4483-4210-ba53-3d978294b96e", |
| 163 | + "metadata": {}, |
| 164 | + "source": [ |
| 165 | + "### Data Types and Operators\n", |
| 166 | + "\n", |
| 167 | + "Python is both a ***strongly typed*** and a ***dynamically typed*** programming language. This makes Python very approachable for newer programmers.\n", |
| 168 | + "\n", |
| 169 | + "***Strongly typed*** refers to the requirement that variables have a type, and that type affects how operations on this variables are performed. Some languages do not check that variables have a type, Python does, but you won't need to worry about this. We will cover data types and operations shortly.\n", |
| 170 | + "\n", |
| 171 | + "***Dynamically typed*** means that data types do not need to be explicitly stated when declaring variables, they are determined from context at runtime." |
| 172 | + ] |
| 173 | + }, |
| 174 | + { |
| 175 | + "cell_type": "code", |
| 176 | + "execution_count": null, |
| 177 | + "id": "307fa78b-1f39-4ce0-8b76-f3eb8bec2875", |
| 178 | + "metadata": {}, |
| 179 | + "outputs": [], |
| 180 | + "source": [ |
| 181 | + "# in some programming languages, you would need to specify a type when declaring a variable\n", |
| 182 | + "# here is an integer declaration in C#/C++\n", |
| 183 | + "# int dogAge = 6;\n", |
| 184 | + "dogAge = 6" |
| 185 | + ] |
| 186 | + }, |
| 187 | + { |
| 188 | + "cell_type": "markdown", |
| 189 | + "id": "a1a8800a-cffb-4fa6-9078-73b10a4b2c29", |
| 190 | + "metadata": {}, |
| 191 | + "source": [ |
| 192 | + "If you run the above code cell, you'll notice there's an error! Try modifying the code so that it declares an integer variable in valid Python code! Ensure the symbolic name is changed to reflect Python standards.\n", |
| 193 | + "\n", |
| 194 | + "Python also features operators that allow us to perform five main types of operations.\n", |
| 195 | + "\n", |
| 196 | + "***Arithmetic Operators***\n", |
| 197 | + "\n", |
| 198 | + "| Operator | Name | Example |\n", |
| 199 | + "|:--------:|:--------------:|:-------:|\n", |
| 200 | + "| + | Addition | x + y |\n", |
| 201 | + "| - | Subtraction | x - y |\n", |
| 202 | + "| * | Multiplication | x * y |\n", |
| 203 | + "| / | Division | x / y |\n", |
| 204 | + "| % | Modulus | x % y |\n", |
| 205 | + "\n", |
| 206 | + "***Assignment Operators***\n", |
| 207 | + "\n", |
| 208 | + "| Operator | Example | Equivalent |\n", |
| 209 | + "|:--------:|:-------:|:----------:|\n", |
| 210 | + "| = | x = 5 | N/A |\n", |
| 211 | + "| += | x += 5 | x = x + 5 |\n", |
| 212 | + "| -= | x -= 5 | x = x - 5 |\n", |
| 213 | + "| *= | x *= 5 | x = x * 5 |\n", |
| 214 | + "| /= | x /= 5 | x = x\n", |
| 215 | + "\n", |
| 216 | + "***Comparison Operators***\n", |
| 217 | + "\n", |
| 218 | + "| Operator | Name | Example |\n", |
| 219 | + "|:--------:|:------------------------:|:-------:|\n", |
| 220 | + "| == | Equal to | x == y |\n", |
| 221 | + "| != | Not equal to | x != y |\n", |
| 222 | + "| > | Greater than | x > y |\n", |
| 223 | + "| < | Less than | x < y |\n", |
| 224 | + "| >= | Greater than or equal to | x >= y |\n", |
| 225 | + "| <= | Less than or equal to | x\n", |
| 226 | + "\n", |
| 227 | + "***Logical Operators***\n", |
| 228 | + "\n", |
| 229 | + "| Operator | Description | Example |\n", |
| 230 | + "|:--------:|:----------------------------------------------------:|:---------------:|\n", |
| 231 | + "| and | Evaluates to True if both statements are True | x < 5 and x > 3 |\n", |
| 232 | + "| or | Evaluates to True if one or both statements are True | x < 5 or x == 7 |\n", |
| 233 | + "| not | Evaluates to True if the statement is False | not(x < 5)\n", |
| 234 | + "\n", |
| 235 | + "***Membership Operators***\n", |
| 236 | + "| Operator | Description | Example |\n", |
| 237 | + "|:--------:|:--------------------------------------------------------------------:|:----------:|\n", |
| 238 | + "| in | Evaluates to True if a sequence contains the specified value | x in y |\n", |
| 239 | + "| not in | Evaluates to True if a sequence does not contain the specified value | x not in y |" |
| 240 | + ] |
| 241 | + }, |
| 242 | + { |
| 243 | + "cell_type": "markdown", |
| 244 | + "id": "a20964f0-1e18-486e-bb13-ae45cdd51b82", |
| 245 | + "metadata": {}, |
| 246 | + "source": [ |
| 247 | + "Don't worry about remembering all of these, they'll start to come naturally with practice, and we'll go through them in the following section!\n", |
| 248 | + "\n", |
| 249 | + "So now we know that we can use these operators to perform operations on various data types, but what data types exist for us to use in Python? There are quite a few, so let's break it down into groups." |
| 250 | + ] |
| 251 | + }, |
| 252 | + { |
| 253 | + "cell_type": "markdown", |
| 254 | + "id": "54f2ea55-e386-42be-884a-d596b545de72", |
| 255 | + "metadata": {}, |
| 256 | + "source": [ |
| 257 | + "#### Basic Data Types\n", |
| 258 | + "\n", |
| 259 | + "Python can be thought of having two categories of data types, a set of basic data types and a set of collection data types.\n", |
| 260 | + "\n", |
| 261 | + "The four basic types are ***integers***, ***floats***, ***strings***, and ***booleans***.\n", |
| 262 | + "\n", |
| 263 | + "***Integers*** are used to represent whole numbers and, as you might imagine, can be used to represent a wide variety of things." |
| 264 | + ] |
| 265 | + }, |
| 266 | + { |
| 267 | + "cell_type": "code", |
| 268 | + "execution_count": null, |
| 269 | + "id": "8e19b343-72d0-46e2-b975-2b7b2828eb79", |
| 270 | + "metadata": {}, |
| 271 | + "outputs": [], |
| 272 | + "source": [ |
| 273 | + "age = 23\n", |
| 274 | + "songs = 173\n", |
| 275 | + "upvotes = 493\n", |
| 276 | + "heart_rate = 74" |
| 277 | + ] |
| 278 | + }, |
| 279 | + { |
| 280 | + "cell_type": "markdown", |
| 281 | + "id": "b9e83ab8-85b3-4f2a-a956-ed1536923c98", |
| 282 | + "metadata": {}, |
| 283 | + "source": [ |
| 284 | + "Let's look at how integers interact with the operators we covered. " |
| 285 | + ] |
| 286 | + }, |
| 287 | + { |
| 288 | + "cell_type": "code", |
| 289 | + "execution_count": null, |
| 290 | + "id": "8d8db9a6-3a10-4661-99b3-5ccfeaeb6205", |
| 291 | + "metadata": {}, |
| 292 | + "outputs": [], |
| 293 | + "source": [ |
| 294 | + "# arithmetic (addition, subtraction, multiplication, division)\n", |
| 295 | + "print(age + songs)\n", |
| 296 | + "print(age - songs)\n", |
| 297 | + "print(age * songs)\n", |
| 298 | + "print(age / songs)\n", |
| 299 | + "\n", |
| 300 | + "# assignment (=, +=, -+, *=, /=)\n", |
| 301 | + "new_int = 30\n", |
| 302 | + "print(new_int)\n", |
| 303 | + "new_int += 5\n", |
| 304 | + "print(new_int)\n", |
| 305 | + "new_int -= 5\n", |
| 306 | + "print(new_int)\n", |
| 307 | + "new_int *= 5\n", |
| 308 | + "print(new_int)\n", |
| 309 | + "new_int /= 5\n", |
| 310 | + "print(new_int)\n", |
| 311 | + "\n", |
| 312 | + "# comparison (==, !=, >, <, >=, <=)\n", |
| 313 | + "print(new_int == heart_rate)\n", |
| 314 | + "print(new_int != heart_rate)\n", |
| 315 | + "print(new_int > heart_rate)\n", |
| 316 | + "print(new_int < heart_rate)\n", |
| 317 | + "print(new_int >= heart_rate)\n", |
| 318 | + "print(new_int <= heart_rate)\n", |
| 319 | + "\n", |
| 320 | + "# logical (and, or)\n", |
| 321 | + "print(age > 18 and songs > 150)\n", |
| 322 | + "print(songs > 150 or upvotes > 500)\n", |
| 323 | + "\n", |
| 324 | + "# membership (in, not in)\n", |
| 325 | + "print(age in [16, 18, 21, 23])\n", |
| 326 | + "print(heart_rate not in [40, 50, 60, 70, 80, 90, 100])" |
| 327 | + ] |
| 328 | + }, |
| 329 | + { |
| 330 | + "cell_type": "markdown", |
| 331 | + "id": "e986a6b3-5717-48bd-8b61-256fb7d66a79", |
| 332 | + "metadata": {}, |
| 333 | + "source": [ |
| 334 | + "***Floats*** are used to represent decimal (or floating-point) numbers." |
| 335 | + ] |
| 336 | + }, |
| 337 | + { |
| 338 | + "cell_type": "code", |
| 339 | + "execution_count": null, |
| 340 | + "id": "81721b6a-e58d-4176-a4a9-66f01806a53c", |
| 341 | + "metadata": {}, |
| 342 | + "outputs": [], |
| 343 | + "source": [ |
| 344 | + "avg_age = 24.8\n", |
| 345 | + "coord_x = 38.693\n", |
| 346 | + "cube_vol = 87.4548\n", |
| 347 | + "temperature = 98.6" |
| 348 | + ] |
| 349 | + }, |
| 350 | + { |
| 351 | + "cell_type": "markdown", |
| 352 | + "id": "23896122-f147-43da-8648-41accf2a9c74", |
| 353 | + "metadata": {}, |
| 354 | + "source": [ |
| 355 | + "Let's look at how floats interact with the operators we covered. In the code cell below, write one statement for each type of operator discussed above (use the code comment for ease). Which operators are not compatible with floats? Make note of them with a comment (you can also place comments on the same line as code, so long as the comment is after the code)." |
| 356 | + ] |
| 357 | + }, |
| 358 | + { |
| 359 | + "cell_type": "code", |
| 360 | + "execution_count": null, |
| 361 | + "id": "97e006bb-76b9-4c99-96b3-1c7f99394896", |
| 362 | + "metadata": {}, |
| 363 | + "outputs": [], |
| 364 | + "source": [ |
| 365 | + "# arithmetic (addition, subtraction, multiplication, division)\n", |
| 366 | + "print(avg_age + coord_x)\n", |
| 367 | + "print(avg_age - coord_x)\n", |
| 368 | + "print(avg_age * coord_x)\n", |
| 369 | + "print(avg_age / coord_x)\n", |
| 370 | + "\n", |
| 371 | + "# assignment (=, +=, -+, *=, /=)\n", |
| 372 | + "new_age = 30.0\n", |
| 373 | + "print(new_age)\n", |
| 374 | + "new_age += 5.0\n", |
| 375 | + "print(new_age)\n", |
| 376 | + "new_age -= 5.0\n", |
| 377 | + "print(new_age)\n", |
| 378 | + "new_age *= 5.0\n", |
| 379 | + "print(new_age)\n", |
| 380 | + "new_age /= 5.0\n", |
| 381 | + "print(new_age)\n", |
| 382 | + "\n", |
| 383 | + "# comparison (==, !=, >, <, >=, <=)\n", |
| 384 | + "print(new_age == avg_age)\n", |
| 385 | + "print(new_age != avg_age)\n", |
| 386 | + "print(new_age > avg_age)\n", |
| 387 | + "print(new_age < avg_age)\n", |
| 388 | + "print(new_age >= avg_age)\n", |
| 389 | + "print(new_age <= avg_age)\n", |
| 390 | + "\n", |
| 391 | + "# logical (and, or)\n", |
| 392 | + "print(avg_age > 18 and new_age > 18)\n", |
| 393 | + "print(avg_age > 18 or new_age > 18)\n", |
| 394 | + "\n", |
| 395 | + "# membership (in, not in)\n", |
| 396 | + "print(avg_age in [16, 18, 21, 25])\n", |
| 397 | + "print(avg_age not in [16, 18, 21, 25])" |
| 398 | + ] |
| 399 | + }, |
| 400 | + { |
| 401 | + "cell_type": "markdown", |
| 402 | + "id": "ac9d236a-e597-4b2e-b3f6-f3e51546dee7", |
| 403 | + "metadata": {}, |
| 404 | + "source": [ |
| 405 | + "***Strings*** are used to represent text and can be thought of as a sequence of characters. Some programming languages have a data type specifically for individual characters, Python does not." |
| 406 | + ] |
| 407 | + }, |
| 408 | + { |
| 409 | + "cell_type": "code", |
| 410 | + "execution_count": 59, |
| 411 | + "id": "e6f36db0-015b-4ec3-ba52-13a9fe527526", |
| 412 | + "metadata": {}, |
| 413 | + "outputs": [], |
| 414 | + "source": [ |
| 415 | + "name = 'Steven'\n", |
| 416 | + "full_name = 'Steven Smith'" |
| 417 | + ] |
| 418 | + }, |
| 419 | + { |
| 420 | + "cell_type": "markdown", |
| 421 | + "id": "1a52e54b-6670-446f-bac5-4e61066e1a7d", |
| 422 | + "metadata": {}, |
| 423 | + "source": [ |
| 424 | + "Let's look at how strings interact with the operators we covered. In the code cell below, write one statement for each type of operator discussed above (use the code comment for ease). Which operators are not compatible with strings? Make note of them with a comment (you can also place comments on the same line as code, so long as the comment is after the code)." |
| 425 | + ] |
| 426 | + }, |
| 427 | + { |
| 428 | + "cell_type": "code", |
| 429 | + "execution_count": null, |
| 430 | + "id": "48397e6e-4bc8-4a7a-9a19-54ebf855134e", |
| 431 | + "metadata": {}, |
| 432 | + "outputs": [], |
| 433 | + "source": [ |
| 434 | + "# arithmetic (addition, subtraction, multiplication, division)\n", |
| 435 | + "name + full_name\n", |
| 436 | + "# name - full_name # subtraction is not supported\n", |
| 437 | + "name * 2\n", |
| 438 | + "# name / 2 # division is not supported\n", |
| 439 | + "\n", |
| 440 | + "# assignment (=, +=, -+, *=, /=)\n", |
| 441 | + "new_name = 'Eddie'\n", |
| 442 | + "new_name += ' Smith'\n", |
| 443 | + "# new_name -= ' Smith' # -= is not supported\n", |
| 444 | + "# new_name /= ' Smith' # /= is not supported\n", |
| 445 | + "\n", |
| 446 | + "# comparison (==, !=, >, <, >=, <=)\n", |
| 447 | + "name == 'Steven'\n", |
| 448 | + "name != 'Eddie'\n", |
| 449 | + "# name > 5 # > not supported\n", |
| 450 | + "# name < 5 # < not supported\n", |
| 451 | + "# name >= 5 # >= not supported\n", |
| 452 | + "# name <= 5 # <= not supported\n", |
| 453 | + "\n", |
| 454 | + "# membership (in, not in)\n", |
| 455 | + "'Ste' in name\n", |
| 456 | + "'Ed' not in name" |
| 457 | + ] |
| 458 | + }, |
| 459 | + { |
| 460 | + "cell_type": "markdown", |
| 461 | + "id": "8cd35b99-5bb3-41a3-87fd-cca3e819662e", |
| 462 | + "metadata": {}, |
| 463 | + "source": [ |
| 464 | + "**Booleans** are used when we want to represent a binary outcome, in other words an outcome that has two possible results. These are often used, for example, to represent true/false or yes/no." |
| 465 | + ] |
| 466 | + }, |
| 467 | + { |
| 468 | + "cell_type": "code", |
| 469 | + "execution_count": 89, |
| 470 | + "id": "2379791e-ffbd-4251-8379-f30e392ee04b", |
| 471 | + "metadata": {}, |
| 472 | + "outputs": [], |
| 473 | + "source": [ |
| 474 | + "is_adult = True\n", |
| 475 | + "is_cold = False" |
| 476 | + ] |
| 477 | + }, |
| 478 | + { |
| 479 | + "cell_type": "markdown", |
| 480 | + "id": "87fe1ac4-6492-4b06-bc7a-cfad702cca0a", |
| 481 | + "metadata": {}, |
| 482 | + "source": [ |
| 483 | + "Let's look at how booleans interact with the operators we covered. In the code cell below, write one statement for each type of operator discussed above (use the code comment for ease). Which operators are not compatible with booleans? Make note of them with a comment (you can also place comments on the same line as code, so long as the comment is after the code)." |
| 484 | + ] |
| 485 | + }, |
| 486 | + { |
| 487 | + "cell_type": "code", |
| 488 | + "execution_count": null, |
| 489 | + "id": "d3e9c087-d363-4ab1-b7f3-4a499b7b035d", |
| 490 | + "metadata": {}, |
| 491 | + "outputs": [], |
| 492 | + "source": [ |
| 493 | + "# note: boolean values are evaluated as integers, so a surprising number of these work!\n", |
| 494 | + "# arithmetic (addition, subtraction, multiplication, division)\n", |
| 495 | + "is_adult + is_cold\n", |
| 496 | + "is_adult - is_cold\n", |
| 497 | + "is_adult * 2\n", |
| 498 | + "is_adult / 2\n", |
| 499 | + "\n", |
| 500 | + "# assignment (=, +=, -+, *=, /=)\n", |
| 501 | + "is_available = True\n", |
| 502 | + "is_available += 1\n", |
| 503 | + "is_available -= 1\n", |
| 504 | + "is_available *= 2\n", |
| 505 | + "is_available /= 2\n", |
| 506 | + "\n", |
| 507 | + "# comparison (==, !=, >, <, >=, <=)\n", |
| 508 | + "is_adult == is_cold\n", |
| 509 | + "is_adult != is_cold\n", |
| 510 | + "is_adult > 1\n", |
| 511 | + "is_adult < 1\n", |
| 512 | + "is_adult >= 1\n", |
| 513 | + "is_adult <= 1\n", |
| 514 | + "\n", |
| 515 | + "# membership (in, not in)\n", |
| 516 | + "# is_adult in is_cold # in is not supported\n", |
| 517 | + "# is_adult not in is_cold # not in is not supported" |
| 518 | + ] |
| 519 | + }, |
| 520 | + { |
| 521 | + "cell_type": "markdown", |
| 522 | + "id": "0c630b4a-6629-4bcb-bc64-997e369e6248", |
| 523 | + "metadata": {}, |
| 524 | + "source": [ |
| 525 | + "#### Collection Data Types\n", |
| 526 | + "\n", |
| 527 | + "There are also four data types that are used to hold ***collections*** of other values/variables. Other than syntax, their differences lie in three metrics: whether the collections is ***ordered***; whether the collection ***allows duplicates***; and whether the collection is ***changeable***.\n", |
| 528 | + "\n", |
| 529 | + "***Tuples*** are the first of the four data types for storing collections. Tuples are ***ordered*** and ***allow duplicates*** but are ***not changeable***." |
| 530 | + ] |
| 531 | + }, |
| 532 | + { |
| 533 | + "cell_type": "code", |
| 534 | + "execution_count": 68, |
| 535 | + "id": "5785bedc-4f35-470e-8feb-3b3fb1d9f78f", |
| 536 | + "metadata": {}, |
| 537 | + "outputs": [], |
| 538 | + "source": [ |
| 539 | + "fruit = ('Apple', 'Banana', 'Cherry')\n", |
| 540 | + "stuff = ('Banana', 4.3, 19, True)\n", |
| 541 | + "more_stuff = ('Cherry', 6.4, 852, False, 'Cherry')" |
| 542 | + ] |
| 543 | + }, |
| 544 | + { |
| 545 | + "cell_type": "markdown", |
| 546 | + "id": "a9e7828b-8d10-4ae3-963b-d7b4836ece33", |
| 547 | + "metadata": {}, |
| 548 | + "source": [ |
| 549 | + "Let's look at how tuples interact with the operators we covered.\n", |
| 550 | + "\n", |
| 551 | + "In the code cell below, declare a tuple variable (try to declare a tuple with various data types contained within, bonus points if your tuple contains another collection data type!), then write one statement for each type of operator discussed above (use the code comment for ease). Which operators are not compatible with tuples? Make note of them with a comment (you can also place comments on the same line as code, so long as the comment is after the code)." |
| 552 | + ] |
| 553 | + }, |
| 554 | + { |
| 555 | + "cell_type": "code", |
| 556 | + "execution_count": null, |
| 557 | + "id": "6872b9e9-e976-4f49-a92a-55eed2640a8f", |
| 558 | + "metadata": {}, |
| 559 | + "outputs": [], |
| 560 | + "source": [ |
| 561 | + "# declare a tuple, bonus points if your tuple contains another collection data type!\n", |
| 562 | + "items = ('dog', 0.34, 14, True)\n", |
| 563 | + "\n", |
| 564 | + "# arithmetic (addition, subtraction, multiplication, division)\n", |
| 565 | + "fruit + items\n", |
| 566 | + "# fruit - item # subtraction is not supported\n", |
| 567 | + "fruit * 2\n", |
| 568 | + "# fruit / 2 # division is not supported\n", |
| 569 | + "\n", |
| 570 | + "# assignment (=, +=, -+, *=, /=)\n", |
| 571 | + "more_items = {'cat', 0.66, 86, False}\n", |
| 572 | + "# more_items += 'dog' # += is not supported\n", |
| 573 | + "# more_items -= 'cat' # -= is not supported\n", |
| 574 | + "# more_items *= 2 # *= is not supported\n", |
| 575 | + "# more_items /= 2 # /= is not supported\n", |
| 576 | + "\n", |
| 577 | + "# comparison (==, !=, >, <, >=, <=)\n", |
| 578 | + "items == ('dog', 0.34, 14, True)\n", |
| 579 | + "items != ('dog', 0.34, 14, True)\n", |
| 580 | + "# items > 5 # > is not supported\n", |
| 581 | + "# items < 5 # < is not supported\n", |
| 582 | + "# items >= 5 # >= is not supported\n", |
| 583 | + "# items <= 5 # <= is not supported\n", |
| 584 | + "\n", |
| 585 | + "# membership (in, not in)\n", |
| 586 | + "'dog' in items\n", |
| 587 | + "'cat' not in items" |
| 588 | + ] |
| 589 | + }, |
| 590 | + { |
| 591 | + "cell_type": "markdown", |
| 592 | + "id": "55c6f7cc-14de-4143-acde-1a5b5cecf204", |
| 593 | + "metadata": {}, |
| 594 | + "source": [ |
| 595 | + "***Lists*** are the second of the four data types for storing collections. Lists are ***ordered***, ***allow duplicates*** and are ***changeable***." |
| 596 | + ] |
| 597 | + }, |
| 598 | + { |
| 599 | + "cell_type": "code", |
| 600 | + "execution_count": 19, |
| 601 | + "id": "ae2434cb-9d6d-4a76-9a6e-5544d48d804b", |
| 602 | + "metadata": {}, |
| 603 | + "outputs": [], |
| 604 | + "source": [ |
| 605 | + "fruit = ['Apple', 'Banana', 'Cherry']\n", |
| 606 | + "stuff = ['Banana', 4.3, 19, True]\n", |
| 607 | + "more_stuff = ['Cherry', 67.4, 852, False, 'Cherry']" |
| 608 | + ] |
| 609 | + }, |
| 610 | + { |
| 611 | + "cell_type": "markdown", |
| 612 | + "id": "63ab5d65-a8b4-4b15-a4fa-a8942e767137", |
| 613 | + "metadata": {}, |
| 614 | + "source": [ |
| 615 | + "Let's look at how lists interact with the operators we covered.\n", |
| 616 | + "\n", |
| 617 | + "In the code cell below, declare a list variable (try to declare a list with various data types contained within, bonus points if your list contains another collection data type!), then write one statement for each type of operator discussed above (use the code comment for ease). Which operators are not compatible with lists? Make note of them with a comment (you can also place comments on the same line as code, so long as the comment is after the code)." |
| 618 | + ] |
| 619 | + }, |
| 620 | + { |
| 621 | + "cell_type": "code", |
| 622 | + "execution_count": null, |
| 623 | + "id": "e4a7a2df-74fa-4b80-b4d9-501b5a0059f5", |
| 624 | + "metadata": {}, |
| 625 | + "outputs": [], |
| 626 | + "source": [ |
| 627 | + "# declare a list, bonus points if your list contains another collection data type!\n", |
| 628 | + "items = ['dog', 0.34, 14, True]\n", |
| 629 | + "\n", |
| 630 | + "# arithmetic (addition, subtraction, multiplication, division)\n", |
| 631 | + "items + ['cat']\n", |
| 632 | + "# items - 'dog' # subtraction is not important\n", |
| 633 | + "items * 2\n", |
| 634 | + "# items / 2 # division is not important\n", |
| 635 | + "\n", |
| 636 | + "# assignment (=, +=, -+, *=, /=)\n", |
| 637 | + "more_items = ['cat', 0.66, 86, False]\n", |
| 638 | + "more_items += ['dog']\n", |
| 639 | + "# more_items -= ['cat'] # -= is not supported\n", |
| 640 | + "more_items *= 2\n", |
| 641 | + "# more_items /= 2 # /= is not supported\n", |
| 642 | + "\n", |
| 643 | + "# comparison (==, !=, >, <, >=, <=)\n", |
| 644 | + "items == more_items\n", |
| 645 | + "items != more_items\n", |
| 646 | + "items > more_items\n", |
| 647 | + "items < more_items\n", |
| 648 | + "items >= more_items\n", |
| 649 | + "items <= more_items\n", |
| 650 | + "\n", |
| 651 | + "# membership (in, not in)\n", |
| 652 | + "'dog' in items\n", |
| 653 | + "'cat' not in items" |
| 654 | + ] |
| 655 | + }, |
| 656 | + { |
| 657 | + "cell_type": "markdown", |
| 658 | + "id": "f6fd9682-2222-4891-97ce-84268723f65e", |
| 659 | + "metadata": {}, |
| 660 | + "source": [ |
| 661 | + "***Sets*** are the third of the four data types for storing collections. Sets are ***not ordered***. ***don't allow duplicates***, and ***not changeable***." |
| 662 | + ] |
| 663 | + }, |
| 664 | + { |
| 665 | + "cell_type": "code", |
| 666 | + "execution_count": 2, |
| 667 | + "id": "574706c4-9df3-44b9-9a0f-84fbfa10229f", |
| 668 | + "metadata": {}, |
| 669 | + "outputs": [], |
| 670 | + "source": [ |
| 671 | + "fruit = {'Apple', 'Banana', 'Cherry'}\n", |
| 672 | + "stuff = {'Banana', 4.3, 19, True}" |
| 673 | + ] |
| 674 | + }, |
| 675 | + { |
| 676 | + "cell_type": "markdown", |
| 677 | + "id": "8c0836c9-ce72-4346-971b-8d2eb51656c3", |
| 678 | + "metadata": {}, |
| 679 | + "source": [ |
| 680 | + "Let's look at how sets interact with the operators we covered.\n", |
| 681 | + "\n", |
| 682 | + "In the code cell below, declare a set variable (try to declare a set with various data types contained within, bonus points if your set contains another collection data type!), then write one statement for each type of operator discussed above (use the code comment for ease). Which operators are not compatible with sets? Make note of them with a comment (you can also place comments on the same line as code, so long as the comment is after the code)." |
| 683 | + ] |
| 684 | + }, |
| 685 | + { |
| 686 | + "cell_type": "code", |
| 687 | + "execution_count": null, |
| 688 | + "id": "34cc4fdc-ca33-40a2-93cc-4d8c681ca5f7", |
| 689 | + "metadata": {}, |
| 690 | + "outputs": [], |
| 691 | + "source": [ |
| 692 | + "# declare a set, bonus points if your set contains another collection data type!\n", |
| 693 | + "items = {'dog', 0.34, 14, True}\n", |
| 694 | + "\n", |
| 695 | + "# arithmetic (addition, subtraction, multiplication, division)\n", |
| 696 | + "# fruit + items # addition is not supported\n", |
| 697 | + "fruit - items\n", |
| 698 | + "# fruit * items # multiplication is not supported\n", |
| 699 | + "# fruit / items # division is not supported\n", |
| 700 | + "\n", |
| 701 | + "# assignment (=, +=, -+, *=, /=)\n", |
| 702 | + "more_items = {'cat', 0.66, 86, False}\n", |
| 703 | + "# more_items += 'dog' # += is not supported\n", |
| 704 | + "# more_items -= 'cat' # -= is not supported\n", |
| 705 | + "# more_items *= 2 # *= is not supported\n", |
| 706 | + "# more_items /= 2 # /= is not supported\n", |
| 707 | + "\n", |
| 708 | + "# comparison (==, !=, >, <, >=, <=)\n", |
| 709 | + "items == {'dog', 0.34, 14, True}\n", |
| 710 | + "items != {'dog', 0.34, 14, True}\n", |
| 711 | + "# items > 5 # > is not supported\n", |
| 712 | + "# items < 5 # < is not supported\n", |
| 713 | + "# items >= 5 # >= is not supported\n", |
| 714 | + "# items <= 5 # <= is not supported\n", |
| 715 | + "\n", |
| 716 | + "# membership (in, not in)\n", |
| 717 | + "'dog' in items\n", |
| 718 | + "'cat' not in items" |
| 719 | + ] |
| 720 | + }, |
| 721 | + { |
| 722 | + "cell_type": "markdown", |
| 723 | + "id": "3d7e6b00-d9d6-499f-af3f-ddb888f737dd", |
| 724 | + "metadata": {}, |
| 725 | + "source": [ |
| 726 | + "***Dictionaries*** are the fourth of the four data types for storing collections. Dictionaries are ***ordered***, don't ***allow duplicates***, but are ***changeable***.\n", |
| 727 | + "\n", |
| 728 | + "*Dictionaries historically were not ordered, but this was changed in Python 3.7.*" |
| 729 | + ] |
| 730 | + }, |
| 731 | + { |
| 732 | + "cell_type": "code", |
| 733 | + "execution_count": null, |
| 734 | + "id": "aa890128-6e80-474c-a2a0-07cb185247f2", |
| 735 | + "metadata": {}, |
| 736 | + "outputs": [], |
| 737 | + "source": [ |
| 738 | + "prices = {'Apple': 0.85, 'Cherry': 1.25}\n", |
| 739 | + "more_stuff['Cherry'] = 0.95" |
| 740 | + ] |
| 741 | + }, |
| 742 | + { |
| 743 | + "cell_type": "markdown", |
| 744 | + "id": "1945cbfd-eff7-437d-b5b7-8b5fcd958708", |
| 745 | + "metadata": {}, |
| 746 | + "source": [ |
| 747 | + "Let's look at how dictionaries interact with the operators we covered.\n", |
| 748 | + "\n", |
| 749 | + "In the code cell below, declare a dictionary variable (try to declare a dictionary with various data types contained within, bonus points if your dictionary contains another collection data type!), then write one statement for each type of operator discussed above (use the code comment for ease). Which operators are not compatible with dictionaries? Make note of them with a comment (you can also place comments on the same line as code, so long as the comment is after the code)." |
| 750 | + ] |
| 751 | + }, |
| 752 | + { |
| 753 | + "cell_type": "code", |
| 754 | + "execution_count": null, |
| 755 | + "id": "a46c294e-8bab-4e04-be4d-4fbecc485019", |
| 756 | + "metadata": {}, |
| 757 | + "outputs": [], |
| 758 | + "source": [ |
| 759 | + "# declare a dictionary, bonus points if your dictionary contains another collection data type!\n", |
| 760 | + "dict = {'list': ['cheese', 1.4, 23], 'num': 42, 'bool': True}\n", |
| 761 | + "\n", |
| 762 | + "# arithmetic (addition, subtraction, multiplication, division)\n", |
| 763 | + "# dict + prices # addition is not supported\n", |
| 764 | + "# dict - prices # subtraction is not supported\n", |
| 765 | + "# dict * prices # multiplication is not supported\n", |
| 766 | + "# dict / prices # division is not supported\n", |
| 767 | + "\n", |
| 768 | + "# assignment (=, +=, -+, *=, /=)\n", |
| 769 | + "# dict += 'hi' # += is not supported\n", |
| 770 | + "# dict -= 'hi' # -= is not supported\n", |
| 771 | + "# dict *= 'hi' # *= is not supported\n", |
| 772 | + "# dict /= 'hi' # /= is not supported\n", |
| 773 | + "\n", |
| 774 | + "# comparison (==, !=, >, <, >=, <=)\n", |
| 775 | + "print(dict == prices)\n", |
| 776 | + "print(dict != prices)\n", |
| 777 | + "# print(dict > prices) # > is not supported\n", |
| 778 | + "# print(dict < prices) # < is not supported\n", |
| 779 | + "# print(dict >= prices) # >= is not supported\n", |
| 780 | + "# print(dict <= prices) # <= is not supported\n", |
| 781 | + "\n", |
| 782 | + "# membership (in, not in)\n", |
| 783 | + "print('list' in dict)\n", |
| 784 | + "print('potato' not in dict)" |
| 785 | + ] |
| 786 | + }, |
| 787 | + { |
| 788 | + "cell_type": "markdown", |
| 789 | + "id": "cc00ee03-4d2b-4e69-8bba-408632138f47", |
| 790 | + "metadata": {}, |
| 791 | + "source": [ |
| 792 | + "For your final task - in the code cell below - try to combine the knowledge you've gained so far to create a small piece of code that creates three variables representing the current temperature, whether it is sunny or not, and yesterday's probability of raining. Your code need to determine what is the probability of raininig today based on his data. If it is sunny, the probability of rain is fixed at 5%. In case it is not sunny, today's probability sees and increase of 20% compared to yesterday if the temperature is higher than 20 C and a decrease of 45% if the temperature is smaller or equal than 20 C.\n", |
| 793 | + "Provide appropriate comments to your code (you can also add inline comments)." |
| 794 | + ] |
| 795 | + }, |
| 796 | + { |
| 797 | + "cell_type": "code", |
| 798 | + "execution_count": null, |
| 799 | + "id": "4994d504-12c4-413b-a153-197850eecc3a", |
| 800 | + "metadata": {}, |
| 801 | + "outputs": [], |
| 802 | + "source": [ |
| 803 | + "## CASE 1 ##\n", |
| 804 | + "# Create your variables\n", |
| 805 | + "current_temperature = 21\n", |
| 806 | + "sunny = True\n", |
| 807 | + "yesterday_p_rain = 50\n", |
| 808 | + "\n", |
| 809 | + "# Determine today's probabilty of rain\n", |
| 810 | + "today_p_rain = 5 # 5% chance of rain" |
| 811 | + ] |
| 812 | + }, |
| 813 | + { |
| 814 | + "cell_type": "code", |
| 815 | + "execution_count": null, |
| 816 | + "id": "eadd8135", |
| 817 | + "metadata": {}, |
| 818 | + "outputs": [], |
| 819 | + "source": [ |
| 820 | + "## CASE 2 ##\n", |
| 821 | + "current_temperature = 21\n", |
| 822 | + "sunny = False\n", |
| 823 | + "yesterday_p_rain = 50\n", |
| 824 | + "\n", |
| 825 | + "# Determine today's probabilty of rain\n", |
| 826 | + "today_p_rain = yesterday_p_rain + (yesterday_p_rain * 0.2) # increase by 20%" |
| 827 | + ] |
| 828 | + }, |
| 829 | + { |
| 830 | + "cell_type": "code", |
| 831 | + "execution_count": null, |
| 832 | + "id": "05fbac82", |
| 833 | + "metadata": {}, |
| 834 | + "outputs": [], |
| 835 | + "source": [ |
| 836 | + "## CASE 3 ##\n", |
| 837 | + "current_temperature = 19\n", |
| 838 | + "sunny = False\n", |
| 839 | + "yesterday_p_rain = 50\n", |
| 840 | + "\n", |
| 841 | + "# Determine today's probabilty of rain\n", |
| 842 | + "today_p_rain = yesterday_p_rain - (yesterday_p_rain * 0.45) # decrease by 45%" |
| 843 | + ] |
| 844 | + }, |
| 845 | + { |
| 846 | + "cell_type": "code", |
| 847 | + "execution_count": 16, |
| 848 | + "id": "240dee48", |
| 849 | + "metadata": {}, |
| 850 | + "outputs": [ |
| 851 | + { |
| 852 | + "name": "stdout", |
| 853 | + "output_type": "stream", |
| 854 | + "text": [ |
| 855 | + "Result: 24.0\n", |
| 856 | + "Result: 24.0\n" |
| 857 | + ] |
| 858 | + } |
| 859 | + ], |
| 860 | + "source": [ |
| 861 | + "## Putting all together ##\n", |
| 862 | + "current_temperature = 21\n", |
| 863 | + "sunny = False\n", |
| 864 | + "yesterday_p_rain = 20\n", |
| 865 | + "\n", |
| 866 | + "# Part 1: Determine whether the temperature is higher than 20 degrees\n", |
| 867 | + "temp_higher = (current_temperature > 20)\n", |
| 868 | + "\n", |
| 869 | + "# Part 2: Determine today's probabilty of rain in case temp_higher is True or False\n", |
| 870 | + "today_p_rain_true = yesterday_p_rain + (yesterday_p_rain * 0.2)\n", |
| 871 | + "today_p_rain_false = yesterday_p_rain - (yesterday_p_rain * 0.45)\n", |
| 872 | + "\n", |
| 873 | + "# Part 3: Combine everything \n", |
| 874 | + "today_p_rain = sunny * 5 + (1 - sunny) * (temp_higher * today_p_rain_true + (not temp_higher) * today_p_rain_false) # remember that True evaluates to 1 and False to 0\n", |
| 875 | + "\n", |
| 876 | + "print(\"Result:\", today_p_rain)\n", |
| 877 | + "\n", |
| 878 | + "\n", |
| 879 | + "# We can also combine all the parts into a single expression\n", |
| 880 | + "today_p_rain = sunny * 5 + (1 - sunny) * ((current_temperature > 20) * (yesterday_p_rain + (yesterday_p_rain * 0.2)) + (current_temperature <= 20) * (yesterday_p_rain - (yesterday_p_rain * 0.45)))\n", |
| 881 | + "# NOTE: the above code is a bit complex and practically rarely used, but it shows how you can combine different data types and operators to create a complex expression.\n", |
| 882 | + "\n", |
| 883 | + "print(\"Result:\", today_p_rain)\n" |
| 884 | + ] |
| 885 | + }, |
| 886 | + { |
| 887 | + "cell_type": "markdown", |
| 888 | + "id": "ac4867e6", |
| 889 | + "metadata": {}, |
| 890 | + "source": [ |
| 891 | + "**Bonus task**: modify the previous code into the code cell below so that the data - temperature, whether it's sunny or not, the probabilities of rain - is stored as a dictionary rather than individual variables and you perform the operations using this collection." |
| 892 | + ] |
| 893 | + }, |
| 894 | + { |
| 895 | + "cell_type": "code", |
| 896 | + "execution_count": 19, |
| 897 | + "id": "8845cee4", |
| 898 | + "metadata": {}, |
| 899 | + "outputs": [ |
| 900 | + { |
| 901 | + "name": "stdout", |
| 902 | + "output_type": "stream", |
| 903 | + "text": [ |
| 904 | + "Result: 24.0\n" |
| 905 | + ] |
| 906 | + } |
| 907 | + ], |
| 908 | + "source": [ |
| 909 | + "# Create a dictionary for the variables\n", |
| 910 | + "data = {\n", |
| 911 | + " 'current_temperature': 21,\n", |
| 912 | + " 'sunny': False,\n", |
| 913 | + " 'yesterday_p_rain': 20\n", |
| 914 | + "}\n", |
| 915 | + "\n", |
| 916 | + "# Part 1: Determine whether the temperature is higher than 20 degrees\n", |
| 917 | + "temp_higher = (data['current_temperature'] > 20)\n", |
| 918 | + "\n", |
| 919 | + "# Part 2: Determine today's probabilty of rain in case temp_higher is True or False\n", |
| 920 | + "today_p_rain_true = data['yesterday_p_rain'] + (data['yesterday_p_rain'] * 0.2)\n", |
| 921 | + "today_p_rain_false = data['yesterday_p_rain'] - (data['yesterday_p_rain'] * 0.45)\n", |
| 922 | + "\n", |
| 923 | + "# Part 3: Combine everything \n", |
| 924 | + "data['today_p_rain'] = data['sunny'] * 5 + (1 - data['sunny']) * (temp_higher * today_p_rain_true + (not temp_higher) * today_p_rain_false)\n", |
| 925 | + "\n", |
| 926 | + "print(\"Result:\", data['today_p_rain'])" |
| 927 | + ] |
| 928 | + } |
| 929 | + ], |
| 930 | + "metadata": { |
| 931 | + "kernelspec": { |
| 932 | + "display_name": "Python 3 (ipykernel)", |
| 933 | + "language": "python", |
| 934 | + "name": "python3" |
| 935 | + }, |
| 936 | + "language_info": { |
| 937 | + "codemirror_mode": { |
| 938 | + "name": "ipython", |
| 939 | + "version": 3 |
| 940 | + }, |
| 941 | + "file_extension": ".py", |
| 942 | + "mimetype": "text/x-python", |
| 943 | + "name": "python", |
| 944 | + "nbconvert_exporter": "python", |
| 945 | + "pygments_lexer": "ipython3", |
| 946 | + "version": "3.10.12" |
| 947 | + } |
| 948 | + }, |
| 949 | + "nbformat": 4, |
| 950 | + "nbformat_minor": 5 |
| 951 | +} |
0 commit comments