{ "nbformat": 4, "nbformat_minor": 0, "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.5" }, "colab": { "name": "Assignment_1.ipynb másolata", "provenance": [], "include_colab_link": true } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "metadata": { "id": "ZPynBP05TcBZ" }, "source": [ "## First Assignment" ] }, { "cell_type": "markdown", "metadata": { "id": "njxQSQ6ITcBn" }, "source": [ "#### 1) Apply the appropriate string methods to the **x** variable (as '.upper') to change it exactly to: \"$Dichlorodiphenyltrichloroethane$\"." ] }, { "cell_type": "code", "metadata": { "id": "2IZj7VMwTcBp" }, "source": [ "x = \"DiClOrod IFeNi lTRicLOr oETaNo DiChlorod iPHeny lTrichL oroEThaNe\"" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 35 }, "id": "pwIg0L0dTcBu", "outputId": "3e35283a-d3b8-47d2-ef5b-288d822e1bd7" }, "source": [ "x[0]+x[1:].lower().replace(\" \", \"\")[27:]" ], "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" }, "text/plain": [ "'Dichlorodiphenyltrichloroethane'" ] }, "metadata": {}, "execution_count": 3 } ] }, { "cell_type": "markdown", "metadata": { "id": "A4tUFuZWTcBw" }, "source": [ "#### 2) Assign respectively the values: 'word', 15, 3.14 and 'list' to variables A, B, C and D in a single line of code. Then, print them in that same order on a single line separated by a space, using only one print statement." ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "9q-iR7MBTcBx", "outputId": "f2e58303-dbf2-4b18-d276-78c4080947db" }, "source": [ "A, B, C, D = 'word', 15, 3.14, 'list' ; print(A, B, C, D)" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "word 15 3.14 list\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "fT-GFMHQTcBy" }, "source": [ "#### 3) Use the **input()** function to receive an input in the form **'68.4 1.71'**, that is, two floating point numbers in a line separated by space. Then, assign these numbers to the variables **w** and **h** respectively, which represent an individual's weight and height (hint: take a look at the '.split()' method). With this data, calculate the individual's Body Mass Index (BMI) from the following relationship: \n", " \n", "\\begin{equation}\n", "BMI = \\dfrac{weight}{height^2}\n", "\\end{equation}" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "c8XLIijGTcB2", "outputId": "6ecb2607-921e-4f26-c999-e45bc288a358" }, "source": [ "w, h = input(\"Adam's weight and height:\").split(); bmi = (float(w)/float(h) ** 2); print(bmi)" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Adam's weight and height:68.4 1.71\n", "23.39181286549708\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "JckU_mAxTcB4" }, "source": [ "#### This value can also be classified according to ranges of values, following to the table below. Use conditional structures to classify and print the classification assigned to the individual. \n", "\n", "
<\\center> \n", "\n", "\n", "(source: https://healthtravelguide.com/bmi-calculator/)" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Ek-HXqWoTcB6", "outputId": "7bd46a1d-2164-4f34-bddd-9bb713784cc5" }, "source": [ "bmi = 23.39181286549708\n", "\n", "if bmi < 18.5 :\n", " print (\"Underweight\")\n", "elif 18.5 <= bmi < 24.9:\n", " print (\"Normal weight\")\n", "elif 25.0 <= bmi < 29.9:\n", " print (\"Pre-obesity\")\n", "elif 30.0 <= bmi < 34.9:\n", " print (\"Obesity class I\")\n", "elif 35.0 <= bmi < 39.9:\n", " print (\"Obesity class II\")\n", "elif 40 <= bmi :\n", " print (\"Obesity class III\")\n", " " ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Normal weight\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "W0igD_rDTcB7" }, "source": [ "#### 4) Receive an integer as an input and, using a loop, calculate the factorial of this number, that is, the product of all the integers from one to the number provided. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "rOgm2FhBTcB-", "outputId": "c8070978-78d2-428c-a7e0-9aeb3e51d5ae" }, "source": [ "num=int(input(\"Enter a number to find factorial: \"))\n", "\n", "factorial=1 \n", "\n", "if num<0:\n", " print(\"Factorial does not defined for negative integer\");\n", "elif(num==0):\n", " print(\"The factorial of 0 is 1\");\n", "else:\n", " while(num>0):\n", " factorial=factorial*num\n", " \n", " num=num-1\n", " \n", " print(\"factorial of the given number is: \")\n", " print(factorial)" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Enter a number to find factorial: 5\n", "factorial of the given number is: \n", "120\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "5nTdpLiETcCA" }, "source": [ "#### 5) Using a while loop and the input function, read an indefinite number of integers until the number read is -1. Present the sum of all these numbers in the form of a print, excluding the -1 read at the end. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "y-IYjAYr2quz", "outputId": "8aa02ea7-7e37-49ec-f123-45dc13c6b8f7" }, "source": [ "x=int(input(\"Enter a number: \"))\n", "\n", "while x != -1 :\n", " print(x, \"is bigger than -1\")\n", " if x > -1 :\n", " x = x -1\n", " else :\n", " x = x + 1" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Enter a number: 5\n", "5 is bigger than -1\n", "4 is bigger than -1\n", "3 is bigger than -1\n", "2 is bigger than -1\n", "1 is bigger than -1\n", "0 is bigger than -1\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "wMhQQbL6TcCC" }, "source": [ "#### 6) Read the **first name** of an employee, his **amount of hours worked** and the **salary per hour** in a single line separated by commas. Next, calculate the **total salary** for this employee and show it to two decimal places." ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "84hLy2tNTcCD", "outputId": "cf4f8b93-2e70-4bde-fcb7-c4b123f8fd23" }, "source": [ "def weeklyPaid(employee, hours_worked, wage_per_hour):\n", " if hours_worked > 40:\n", " return 40 * wage_per_hour + (hours_worked - 40) * wage_per_hour * 1.5\n", " else:\n", " return hours_worked * wage_per_hour\n", " \n", "employee = \"Matilde\" \n", "hours_worked = 50\n", "wage_per_hour = 120\n", " \n", "pay = weeklyPaid(employee, hours_worked, wage_per_hour)\n", " \n", "print(f\"Total gross pay of {employee} : EUR {pay:.2f} \")" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Total gross pay of Matilde : EUR 6600.00 \n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "tQuoIHpJTcCE" }, "source": [ "#### 7) Read three floating point values **A**, **B** and **C** respectively. Then calculate itens a, b, c, d and e: " ] }, { "cell_type": "code", "metadata": { "id": "Q22hGIhwTcCF" }, "source": [ "A, B, C = 1.1, 2.2, 3.3 " ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "hpEdvP3aTcCG" }, "source": [ " a) the area of the triangle rectangle with A as the base and C as the height." ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "jibQBjc8TcCK", "outputId": "394994bc-a23a-4cf0-851e-5e6a1499247e" }, "source": [ "base = int(A)\n", "height = int(C)\n", "Area = (base * height) / 2\n", "\n", "print(\"The area of the triangle rectangle =\", Area)" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "The area of the triangle rectangle = 1.5\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "072VUJ8sTcCL" }, "source": [ " b) the area of the circle of radius C. (pi = 3.14159) " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "mdcaJXd5TcCM", "outputId": "b64cbbc4-cc4d-40f1-8257-fadf74937252" }, "source": [ "radius = int(C)\n", "pi = 3.14159\n", "Area = pi * radius * radius\n", "print(\"Area of the circle = \" + str(Area))" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Area of the circle = 28.274309999999996\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "n-mqI6I7TcCO" }, "source": [ " c) the area of the trapezoid that has A and B for bases and C for height. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "hg-D448UTcCP", "outputId": "a3ae711b-d8cc-4cd4-c891-85129b811025" }, "source": [ "base_1 = int(A)\n", "base_2 = int(B)\n", "height = int(C)\n", "Area = (base_1+base_2)*height/2\n", "print(\"Area of the trapezoid = \" + str(Area))" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Area of the trapezoid = 4.5\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "Bd21ekUDTcCQ" }, "source": [ " d) the area of the square that has side B. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "3wiiGCn7TcCR", "outputId": "e53188f0-3f89-4f81-fd19-302eab5e19e3" }, "source": [ "side = int(B) \n", "Area = side ** 2\n", "print(\"Area of the square = \" + str(Area))" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Area of the square = 4\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "0VK4OkQHTcCR" }, "source": [ " e) the area of the rectangle that has sides A and B. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "F5FWeUVUTcCS", "outputId": "a30a19d7-5d49-4b2b-fe74-cbaabbdfe9de" }, "source": [ "width = int(A)\n", "height = int(B)\n", "Area = width * height\n", "print(\"The area of the rectangle = \" + str(Area))" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "The area of the rectangle = 2\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "XoofLmbhTcCS" }, "source": [ "#### 8) Read **the values a, b and c** and calculate the **roots of the second degree equation** $ax^{2}+bx+c=0$ using [this formula](https://en.wikipedia.org/wiki/Quadratic_equation). If it is not possible to calculate the roots, display the message **“There are no real roots”**. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "qXBlTwCqokmG", "outputId": "c7b96f99-d229-419c-e07c-fa6dbd41ba44" }, "source": [ "a, b, c = 0.23, 1.45, 3.77\n", "\n", "r = b**2 - 4*a*c\n", "\n", "if r > 0:\n", " num_roots = 2\n", " x1 = (((-b) + sqrt(r))/(2*a)) \n", " x2 = (((-b) - sqrt(r))/(2*a))\n", " print(\"There are 2 roots: %f and %f\" % (x1, x2))\n", "elif r == 0:\n", " num_roots = 1\n", " x = (-b) / 2*a\n", " print(\"There is one root: \", x)\n", "else:\n", " num_roots = 0\n", " print(\"There are no real roots.\")\n" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "There are no real roots.\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "AXIlVg_cTcCV" }, "source": [ "#### 9) Read four floating point numerical values corresponding to the coordinates of two geographical coordinates in the cartesian plane. Each point will come in a line with its coordinates separated by space. Then calculate and show the distance between these two points. \n", "\n", "(obs: $d=\\sqrt{(x_1-x_2)^2 + (y_1-y_2)^2}$)" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "8vS1M_9LTcCV", "outputId": "0ccec577-ab17-4fa8-83ec-867dfc43c707" }, "source": [ "x1, x2, y1, y2 = 1.11, 2.32, 4.56, 5.23\n", "\n", "result= ((((x2 - x1 )**2) + ((y2-y1)**2) )**0.5)\n", "\n", "print(\"distance(d) between\",(x1,x2),\"and\",(y1,y2),\"is : \",result)" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "distance(d) between (1.11, 2.32) and (4.56, 5.23) is : 1.3831124321616086\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "EIxV_YncTcCY" }, "source": [ "#### 10) Read **two floating point numbers** on a line that represent **coordinates of a cartesian point**. With this, use **conditional structures** to determine if you are at the origin, printing the message **'origin'**; in one of the axes, printing **'x axis'** or **'y axis'**; or in one of the four quadrants, printing **'q1'**, **'q2**', **'q3'** or **'q4'**. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "JbpAEyaeTcCa", "outputId": "e0d10117-36e5-493a-9e07-88d5a8fa14a4" }, "source": [ "def quadrant(x, y):\n", "\tif (x > 0 and y > 0):\n", "\t\tprint (\"lies in First quadrant\")\n", "\telif (x < 0 and y > 0):\n", "\t\tprint (\"lies in Second quadrant\")\n", "\telif (x < 0 and y < 0):\n", "\t\tprint (\"lies in Third quadrant\")\n", "\telif (x > 0 and y < 0):\n", "\t\tprint (\"lies in Fourth quadrant\")\n", "\telif (x == 0 and y > 0):\n", "\t\tprint (\"lies at positive y axis\")\n", "\telif (x == 0 and y < 0):\n", "\t\tprint (\"lies at negative y axis\")\n", "\telif (y == 0 and x < 0):\n", "\t\tprint (\"lies at negative x axis\")\n", "\telif (y == 0 and x > 0):\n", "\t\tprint (\"lies at positive x axis\")\n", "\telse:\n", "\t\tprint (\"lies at origin\")\n", "\n", "x = 1\n", "y = 1\n", "quadrant(x, y)" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "lies in First quadrant\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "wx_uJeoZTcCa" }, "source": [ "#### 11) Read an integer that represents a phone code for international dialing. \n", "#### Then, inform to which country the code belongs to, considering the generated table below:\n", "(You just need to consider the first 10 entries) " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 662 }, "id": "BkXXbQUoTcCc", "outputId": "07d6597c-7d74-4a6c-f109-c685480cdf67" }, "source": [ "import pandas as pd\n", "df = pd.read_html('https://en.wikipedia.org/wiki/Telephone_numbers_in_Europe')[1]\n", "df = df.iloc[:,:2]\n", "df.head(20)" ], "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CountryCountry calling code
0Austria43
1Belgium32
2Bulgaria359
3Croatia385
4Cyprus357
5Czech Republic420
6Denmark45
7Estonia372
8Finland358
9France33
10Germany49
11Greece30
12Hungary36
13Iceland354
14Ireland353
15Italy39
16Latvia371
17Liechtenstein423
18Lithuania370
19Luxembourg352
\n", "
" ], "text/plain": [ " Country Country calling code\n", "0 Austria 43\n", "1 Belgium 32\n", "2 Bulgaria 359\n", "3 Croatia 385\n", "4 Cyprus 357\n", "5 Czech Republic 420\n", "6 Denmark 45\n", "7 Estonia 372\n", "8 Finland 358\n", "9 France 33\n", "10 Germany 49\n", "11 Greece 30\n", "12 Hungary 36\n", "13 Iceland 354\n", "14 Ireland 353\n", "15 Italy 39\n", "16 Latvia 371\n", "17 Liechtenstein 423\n", "18 Lithuania 370\n", "19 Luxembourg 352" ] }, "metadata": {}, "execution_count": 93 } ] }, { "cell_type": "markdown", "metadata": { "id": "keAcbDRocIzO" }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "id": "J3VbimgboVNl" }, "source": [ "" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "luPiSycjTcCe", "outputId": "3833d347-25af-4967-a935-6ef5d3efbbb8" }, "source": [ "Country_calling_code = int(input('Enter a number: '))\n", "CountryCall_dict = {43:'Austria',\n", " 32:'Belgium',\n", " 359:'Bulgaria',\n", " 385:'Croatia',\n", " 357:'Cyprus',\n", " 420:'Czech Republic',\n", " 45:'Denmark',\n", " 372:'Estonia',\n", " 359:'Finland',\n", " 33:'France',\n", " 49: 'Germany'}\n", "\n", "if Country_calling_code in CountryCall_dict.keys():\n", " print(CountryCall_dict[Country_calling_code])\n", "else:\n", " print('No result.')" ], "execution_count": 1, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Enter a number: 43\n", "Austria\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "MjOK3SGQ8Yrb" }, "source": [ "" ] }, { "cell_type": "markdown", "metadata": { "id": "v3qAwa4STcCg" }, "source": [ "#### 12) Write a piece of code that reads 6 numbers in a row. Next, show the number of positive values entered. On the next line, print the average of the values to one decimal place. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "lyJcX---TcCh", "outputId": "dbdb056e-52ac-4f10-9fa6-bf12d87b7e5c" }, "source": [ "import statistics\n", " \n", "data1 = [1, 3, 4, 5, 7, 9]\n", " \n", "x = statistics.mean(data1)\n", "print(f\"Mean is: {x:.1f}\")" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Mean is: 4.8\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "SFj5ve-ZTcCh" }, "source": [ "#### 13) Read an integer **N**. Then print the **square of each of the even values**, from 1 to N, including N, if applicable, arranged one per line. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "zOEQPjt9TcCi", "outputId": "125e4c93-c300-4024-c484-30be4f52a3f1" }, "source": [ "def printSquares(n):\n", " \n", " square = 0; prev_x = 0;\n", " for x in range(1, n+1):\n", " square = (square + x + prev_x)\n", " print(square, end = \" \")\n", " prev_x = x\n", "\n", "n = 6;\n", "printSquares(n)" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "1 4 9 16 25 36 " ] } ] }, { "cell_type": "markdown", "metadata": { "id": "RYJBwdrUTcCj" }, "source": [ "#### 14) Using **input()**, read an integer and print its classification as **'even / odd'** and **'positive / negative'** . The two classes for the number must be printed on the same line separated by a space. In the case of zero, print only **'null'**. " ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "0bSCk-9DTcCk", "outputId": "c31f9bc8-2d55-47cb-916c-1c83bd47d263" }, "source": [ "num = int(input(\"Enter a number: \"))\n", "if num >= 0:\n", " if num == 0:\n", " print(\"Zero\")\n", " else:\n", " print(\"Positive number\")\n", "else:\n", " print(\"Negative number\")\n", " \n", "if (num % 2) == 0:\n", " print(\"{0} is Even\".format(num))\n", "else:\n", " print(\"{0} is Odd\".format(num))" ], "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Enter a number: 10\n", "Positive number\n", "10 is Even\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "T_Ic7VjZTcCk" }, "source": [ "## Challenge\n", "#### 15) Ordering problems are recurrent in the history of programming. Over time, several algorithms have been developed to fulfill this function. The simplest of these algorithms is the [**Bubble Sort**](https://en.wikipedia.org/wiki/Bubble_sort), which is based on comparisons of elements two by two in a loop of passes through the elements. Your mission, if you decide to accept it, will be to input six whole numbers ramdonly ordered. Then implement the **Bubble Sort** principle to order these six numbers **using only loops and conditionals**. \n", "#### At the end, print the six numbers in ascending order on a single line separated by spaces. " ] }, { "cell_type": "code", "metadata": { "id": "mVhe_WU4TcCl" }, "source": [ "" ], "execution_count": null, "outputs": [] } ] }