{ "cells": [ { "cell_type": "markdown", "id": "db84ab1b-113c-40e7-9d5b-ee6d3bc15611", "metadata": {}, "source": [ "# Class 2 notes\n", "\n", "## Geo-Python concepts to review\n", "\n", "- `for` loops\n", "- functions\n", "- When to use which brackets in Python\n", " - (), [], {}" ] }, { "cell_type": "markdown", "id": "6117c120-fb29-4a2f-9717-b7bcb006b712", "metadata": {}, "source": [ "## Ideas for Part 2\n", "\n", "- Mining data from tables in PDF documents\n", "- Mining graphs from literature, reconstructing them and plotting our data.\n", "- Classes in Python\n", " - Introduce the basic ideas and provide a simple example" ] }, { "cell_type": "code", "execution_count": 4, "id": "2a65f1a6-8040-4d73-ac2a-18055b26e49d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "20.0\n" ] } ], "source": [ "# Calculating temperature in C from F\n", "temp_f = 68.0\n", "temp_c = (temp_f - 32) * (5/9)\n", "print(temp_c)" ] }, { "cell_type": "code", "execution_count": 5, "id": "cfea259b-d355-43cc-8e22-ec52da535fe0", "metadata": {}, "outputs": [], "source": [ "# Calculating temperature in C from F in a function\n", "def fahr_to_celsius(tempF):\n", " tempC = (tempF - 32) * (5/9)\n", " return tempC" ] }, { "cell_type": "code", "execution_count": 6, "id": "282d52fa-694a-4522-8174-55f3421bc0c7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "20.0\n" ] } ], "source": [ "# Passing in a variable with a different name than used in the function\n", "temp_celsius = fahr_to_celsius(temp_f)\n", "print(temp_celsius)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 5 }