{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Your Student ID:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 6204641218"
   ]
  },
  {
   "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": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2022-08-23\n"
     ]
    }
   ],
   "source": [
    "from datetime import date\n",
    "today = str(date.today())\n",
    "print(today)"
   ]
  },
  {
   "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": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = [1,3,1,2,9,4,5,6,10,4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.9410882339705484"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def get_std_dev(data):\n",
    "    n = len(data)\n",
    "    mean = sum(data) / n\n",
    "    var = sum((x - mean)**2 for x in data) / n\n",
    "    std_dev = var ** 0.5\n",
    "    return std_dev\n",
    "\n",
    "get_std_dev(data)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.2 Then, you have the additional data as shown below"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "add_data =[8,11,2,5,6,4,3,2]"
   ]
  },
  {
   "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": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "data2 = "
   ]
  },
  {
   "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": 12,
   "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": 19,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fx_rate EUR/GBP\n"
     ]
    }
   ],
   "source": [
    "forex = 'fx_rate EUR/GBP'\n",
    "print(forex)"
   ]
  },
  {
   "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": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# your code here -- notice the comment!"
   ]
  }
 ],
 "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.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
