From 697513118305e4475db6e610b73647296975726a Mon Sep 17 00:00:00 2001
From: Franziska Niemeyer <franziska.niemeyer@uni-bielefeld.de>
Date: Mon, 8 Aug 2022 09:26:02 +0200
Subject: [PATCH] Upload solutions for gap_exercise2_functions

---
 .../solutions/gap_exercise2_functions.ipynb   | 166 ++++++++++++++++++
 1 file changed, 166 insertions(+)
 create mode 100644 Exercises/solutions/gap_exercise2_functions.ipynb

diff --git a/Exercises/solutions/gap_exercise2_functions.ipynb b/Exercises/solutions/gap_exercise2_functions.ipynb
new file mode 100644
index 0000000..d8c28af
--- /dev/null
+++ b/Exercises/solutions/gap_exercise2_functions.ipynb
@@ -0,0 +1,166 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 0,
+  "metadata": {
+    "colab": {
+      "name": "gap_exercise2_functions.ipynb",
+      "provenance": [],
+      "collapsed_sections": []
+    },
+    "kernelspec": {
+      "name": "python3",
+      "display_name": "Python 3"
+    },
+    "language_info": {
+      "name": "python"
+    }
+  },
+  "cells": [
+    {
+      "cell_type": "markdown",
+      "source": [
+        "# Python course - Exercises Gap text"
+      ],
+      "metadata": {
+        "id": "kH0p2uT-sQ6y",
+        "pycharm": {
+          "name": "#%% md\n"
+        }
+      }
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "Correct the Code"
+      ],
+      "metadata": {
+        "id": "uW9SoYEyrlRL",
+        "pycharm": {
+          "name": "#%% md\n"
+        }
+      }
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "# How are functions defined?\n",
+        "def my_function(b):\n",
+        "  print(b+10)\n",
+        "\n",
+        "a=5\n",
+        "my_function(a)"
+      ],
+      "metadata": {
+        "id": "uoscfCSCK980",
+        "pycharm": {
+          "name": "#%%\n"
+        },
+        "outputId": "8fcbf234-1326-4646-dd6e-22fd75234693",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": 1,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "15\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "# What is missing?\n",
+        "def concat_sequences( seq1, seq2, seq3 ):\n",
+        "  print(seq1 + seq2 + seq3)\n",
+        "\n",
+        "concat_sequences('ACGTC', 'GTCAA', 'TTACC')"
+      ],
+      "metadata": {
+        "id": "VI2uTjtJMZ-L",
+        "pycharm": {
+          "name": "#%%\n"
+        },
+        "outputId": "0325b131-f435-4260-df26-4d917944680d",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": 3,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "ACGTCGTCAATTACC\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "# correct the code such that the function delivers b+10\n",
+        "def my_function(b):\n",
+        "  return (b+10)\n",
+        "\n",
+        "result = my_function(5)\n",
+        "print(result)"
+      ],
+      "metadata": {
+        "id": "GN89HlxMJRAQ",
+        "pycharm": {
+          "name": "#%%\n"
+        },
+        "outputId": "01ad604f-0877-457e-fabc-2cb8b922fc2a",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": 4,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "15\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "# undefined number of arguments: what is needed?\n",
+        "def concat_sequences( seq ):\n",
+        "  print(seq[0] + seq[1] + seq[2])\n",
+        "\n",
+        "concat_sequences(['ACGTC', 'GTCAA', 'TAGCTGC'])"
+      ],
+      "metadata": {
+        "id": "UOsFUQSHKGXH",
+        "pycharm": {
+          "name": "#%%\n"
+        },
+        "outputId": "1fd92f39-73a6-4777-cddb-b7cf6c9108ad",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": 7,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "ACGTCGTCAATAGCTGC\n"
+          ]
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
-- 
GitLab