[go: nahoru, domu]

Skip to content

Commit

Permalink
Created using Colaboratory
Browse files Browse the repository at this point in the history
  • Loading branch information
noahgift committed Mar 24, 2020
1 parent 940af91 commit 936a23d
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions Chapter3_Functions.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Chapter3-Functions.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyMhdN3Yhf6qlKvG8GKmA1Oy",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/paiml/minimal-python/blob/master/Chapter3_Functions.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "yh19-aXLq7Q1",
"colab_type": "text"
},
"source": [
"## Marco Polo\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "knRQcVkxqw2u",
"colab_type": "code",
"colab": {}
},
"source": [
"def marco(name):\n",
" if name == \"Marco\":\n",
" return \"Polo\""
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "R5kUcEe0uRnf",
"colab_type": "code",
"outputId": "0ace8638-6997-4d2c-8a4e-9f0607c56477",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"source": [
"marco(\"Marco\")"
],
"execution_count": 2,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'Polo'"
]
},
"metadata": {
"tags": []
},
"execution_count": 2
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "_xBr9VzH2T4n",
"colab_type": "code",
"colab": {}
},
"source": [
"marco(\"Bob\")"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "UDZ2koud4rxW",
"colab_type": "text"
},
"source": [
"*Challenge: Write your own simple function that take a variable and returns something else if a phrase is matched. For example something like this:* \n",
"\n",
"```python\n",
"if dollars == 1000:\n",
" return \"rich\"\n",
"```\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "D1F7tXsfu-u3",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}

0 comments on commit 936a23d

Please sign in to comment.