{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Your Student ID:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# your student ID\n",
    "# 6504930246\n",
    "# Devon Kelly"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Question 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# This task, you want to find out Today's date by using the library time\n",
    "\n",
    "Hint: Use time.FUNC_NAME.FUNC_NAME? (where FUNC_NAME is replaced with the function you found) to see information about that function and then call the function."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Todays date is the 23rd\n"
     ]
    }
   ],
   "source": [
    "import time as t\n",
    "\n",
    "# your code here -- notice the comment!\n",
    "\n",
    "todaysdate = t.localtime()\n",
    "#print(todaysdate)\n",
    "print(f\"Todays date is the {todaysdate[2]}rd\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Question  2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.1 What is the standard deviation of the data:\n",
    "\n",
    "Hint: Using the function std in library Numpy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = [1,3,1,2,9,4,5,6,10,4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " The standard deviation of the data is 2.9410882339705484\n"
     ]
    }
   ],
   "source": [
    "# your code here -- notice the comment!\n",
    "import numpy as np\n",
    "print(f\" The standard deviation of the data is {np.std(data)}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.2 Then, you have the additional data as shown below"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "#data = [1,3,1,2,9,4,5,6,10,4]\n",
    "#print(data)\n",
    "#add_data = [8,11,2,5,6,4,3,2]\n",
    "#print(add_data)\n",
    "#print(data.extend(add_data))\n",
    "\n",
    "# Returning None for some reason"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Add the new data to the original data, then re-calculate the standard deviation again."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 3, 1, 2, 9, 4, 5, 6, 10, 4, 8, 11, 2, 5, 6, 4, 3, 2]\n",
      "2.954385733401851\n"
     ]
    }
   ],
   "source": [
    "# your code here -- notice the comment!\n",
    "data = [1,3,1,2,9,4,5,6,10,4]\n",
    "add_data = [8,11,2,5,6,4,3,2]\n",
    "\n",
    "for i in range(len(add_data)):\n",
    "    data.append(add_data[i])\n",
    "\n",
    "print(data)\n",
    "print(np.std(data))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Question 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Consider the below information:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [],
   "source": [
    "data ={'Year':'2021','transactional data':{\n",
    " 'transaction_id': 1000001,\n",
    " 'source_country': 'United Kingdom',\n",
    " 'target_country': 'Italy',\n",
    " 'send_currency': 'GBP',\n",
    " 'send_amount': 'GBP1000.00',\n",
    " 'target_currency': 'EUR',\n",
    " 'fx_rate EUR/GBP': 1.1648674,\n",
    " 'fee_pct': 0.50, \n",
    " 'platform': 'mobile'}}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.1 Using the python code to pick up the foreign exchange rate  ('fx_rate EUR/GBP') from this dataset."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.1648674\n"
     ]
    }
   ],
   "source": [
    "# your code here -- notice the comment!\n",
    "#print(data.keys())\n",
    "print(data['transactional data']['fx_rate EUR/GBP'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.2 You now need to include the data for the \"fee_amount,\" which can be determined from the funds you send to the target country (send_amount) multiplied by the fee percentage (fee_pct). \n",
    "\n",
    "Create the new keyword \"fee_amount\" for this dataset, and then report its value.\n",
    "\n",
    "Hint: using replace() and float() to convert the 'send_amount' into a number.Then, multiply with fee percentage."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "500.0\n"
     ]
    }
   ],
   "source": [
    "# your code here -- notice the comment!\n",
    "send = float(data['transactional data']['send_amount'][3:])\n",
    "fee = data['transactional data']['fee_pct']\n",
    "#print(send, fee)\n",
    "fee_amount = (send * fee)\n",
    "print(fee_amount)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "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.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
