{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## First Assignment" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 1) Apply the appropriate string methods to the **x** variable (as '.upper') to change it exactly to: \"$Dichlorodiphenyltrichloroethane$\"." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "x = \"DiClOrod IFeNi lTRicLOr oETaNo DiChlorod iPHeny lTrichL oroEThaNe\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "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", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "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", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "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", "
\n", " | Country | \n", "Country calling code | \n", "
---|---|---|
0 | \n", "Austria | \n", "43 | \n", "
1 | \n", "Belgium | \n", "32 | \n", "
2 | \n", "Bulgaria | \n", "359 | \n", "
3 | \n", "Croatia | \n", "385 | \n", "
4 | \n", "Cyprus | \n", "357 | \n", "
5 | \n", "Czech Republic | \n", "420 | \n", "
6 | \n", "Denmark | \n", "45 | \n", "
7 | \n", "Estonia | \n", "372 | \n", "
8 | \n", "Finland | \n", "358 | \n", "
9 | \n", "France | \n", "33 | \n", "
10 | \n", "Germany | \n", "49 | \n", "
11 | \n", "Greece | \n", "30 | \n", "
12 | \n", "Hungary | \n", "36 | \n", "
13 | \n", "Iceland | \n", "354 | \n", "
14 | \n", "Ireland | \n", "353 | \n", "
15 | \n", "Italy | \n", "39 | \n", "
16 | \n", "Latvia | \n", "371 | \n", "
17 | \n", "Liechtenstein | \n", "423 | \n", "
18 | \n", "Lithuania | \n", "370 | \n", "
19 | \n", "Luxembourg | \n", "352 | \n", "