diff --git a/000_Python_Flow_Control_statement .ipynb b/000_Python_Flow_Control_statement .ipynb index d9269ec..099d254 100644 --- a/000_Python_Flow_Control_statement .ipynb +++ b/000_Python_Flow_Control_statement .ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "\n", - "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", + "All the IPython Notebooks in **Python Flow Control Statements** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", "" ] }, diff --git a/001_Python_if_statement.ipynb b/001_Python_if_statement.ipynb index 07fff89..a25310c 100644 --- a/001_Python_if_statement.ipynb +++ b/001_Python_if_statement.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "\n", - "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", + "All the IPython Notebooks in **Python Flow Control Statements** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", "" ] }, diff --git a/002_Python_if_else_statement.ipynb b/002_Python_if_else_statement.ipynb index 218cddc..7d64e78 100644 --- a/002_Python_if_else_statement.ipynb +++ b/002_Python_if_else_statement.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "\n", - "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", + "All the IPython Notebooks in **Python Flow Control Statements** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", "" ] }, @@ -23,9 +23,10 @@ "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:15.066732Z", - "start_time": "2021-06-26T15:16:15.053061Z" - } + "end_time": "2021-10-04T07:16:58.412652Z", + "start_time": "2021-10-04T07:16:58.381404Z" + }, + "scrolled": true }, "outputs": [ { @@ -95,8 +96,8 @@ "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:16.487612Z", - "start_time": "2021-06-26T15:16:16.469061Z" + "end_time": "2021-10-04T07:16:58.535698Z", + "start_time": "2021-10-04T07:16:58.415580Z" } }, "outputs": [ @@ -124,8 +125,8 @@ "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:17.126278Z", - "start_time": "2021-06-26T15:16:17.108704Z" + "end_time": "2021-10-04T07:16:58.644099Z", + "start_time": "2021-10-04T07:16:58.540581Z" } }, "outputs": [ @@ -170,8 +171,8 @@ "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:18.030567Z", - "start_time": "2021-06-26T15:16:18.019827Z" + "end_time": "2021-10-04T07:16:58.659725Z", + "start_time": "2021-10-04T07:16:58.648003Z" } }, "outputs": [ @@ -198,8 +199,8 @@ "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:18.498333Z", - "start_time": "2021-06-26T15:16:18.488571Z" + "end_time": "2021-10-04T07:16:58.798390Z", + "start_time": "2021-10-04T07:16:58.662651Z" } }, "outputs": [ @@ -242,8 +243,8 @@ "execution_count": 6, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:19.498326Z", - "start_time": "2021-06-26T15:16:19.484656Z" + "end_time": "2021-10-04T07:16:58.920462Z", + "start_time": "2021-10-04T07:16:58.806208Z" } }, "outputs": [ @@ -266,8 +267,31 @@ "execution_count": 7, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:19.950469Z", - "start_time": "2021-06-26T15:16:19.936797Z" + "end_time": "2021-10-04T07:16:59.059135Z", + "start_time": "2021-10-04T07:16:58.931207Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A is positive\n" + ] + } + ], + "source": [ + "a = 3\n", + "print('A is positive') if a > 0 else print('A is negative') # first condition met, 'A is positive' will be printed" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T07:16:59.183158Z", + "start_time": "2021-10-04T07:16:59.070854Z" } }, "outputs": [ @@ -286,11 +310,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:20.466084Z", - "start_time": "2021-06-26T15:16:20.445582Z" + "end_time": "2021-10-04T07:16:59.325248Z", + "start_time": "2021-10-04T07:16:59.189017Z" } }, "outputs": [ @@ -310,11 +334,11 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:20.933857Z", - "start_time": "2021-06-26T15:16:20.917257Z" + "end_time": "2021-10-04T07:16:59.429251Z", + "start_time": "2021-10-04T07:16:59.328177Z" } }, "outputs": [ @@ -336,11 +360,11 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:21.402602Z", - "start_time": "2021-06-26T15:16:21.384048Z" + "end_time": "2021-10-04T07:16:59.538139Z", + "start_time": "2021-10-04T07:16:59.437065Z" } }, "outputs": [ @@ -372,11 +396,11 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:21.901620Z", - "start_time": "2021-06-26T15:16:21.891856Z" + "end_time": "2021-10-04T07:16:59.660693Z", + "start_time": "2021-10-04T07:16:59.542045Z" } }, "outputs": [ @@ -408,11 +432,11 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:16:22.838622Z", - "start_time": "2021-06-26T15:16:22.804444Z" + "end_time": "2021-10-04T07:16:59.814505Z", + "start_time": "2021-10-04T07:16:59.664116Z" } }, "outputs": [ @@ -429,7 +453,7 @@ "'\\nOutput: num2 is lesser than num1\\n'" ] }, - "execution_count": 12, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -464,6 +488,34 @@ "Your program should logically include every possible test case and only then your program will produce accurate results. So this mean **you need to add another conditional statement to check if num1 is equal to num 2**. Let us now see how this can be done." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 💻 Exercises ➞ List\n", + "\n", + "1. Get user input using **`input(“Enter your age: ”)`**. If user is 18 or older, give feedback: **`You are old enough to drive`**. If below 18 give feedback to **`wait for the missing amount of years`**. \n", + "\n", + "Output:\n", + "\n", + "```py\n", + " Enter your age: 30\n", + " You are old enough to learn to drive.\n", + " Output:\n", + " Enter your age: 15\n", + " You need 3 more years to learn to drive.\n", + "```\n", + "\n", + "2. Compare the values of my_age and your_age using **`if-else`**. Who is older (me or you)? Use **`input(“Enter your age: ”)`** to get the age as input. You can use a nested condition to print **`'year'`** for 1 year difference in age, **`'years'`** for bigger differences, and a custom text if **`my_age = your_age`**. \n", + "\n", + "Output:\n", + "\n", + "```py\n", + " Enter your age: 30\n", + " You are 5 years older than me.\n", + "```" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/003_Python_if_elif_else_statement .ipynb b/003_Python_if_elif_else_statement .ipynb index b15ea1b..28f651b 100644 --- a/003_Python_if_elif_else_statement .ipynb +++ b/003_Python_if_elif_else_statement .ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "\n", - "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", + "All the IPython Notebooks in **Python Flow Control Statements** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", "" ] }, @@ -56,8 +56,8 @@ "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2021-06-10T21:32:27.675471Z", - "start_time": "2021-06-10T21:32:27.667679Z" + "end_time": "2021-10-04T08:50:54.861499Z", + "start_time": "2021-10-04T08:50:54.848803Z" } }, "outputs": [ @@ -107,8 +107,8 @@ "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2021-06-10T21:32:28.784651Z", - "start_time": "2021-06-10T21:32:28.767125Z" + "end_time": "2021-10-04T08:50:55.015301Z", + "start_time": "2021-10-04T08:50:54.876146Z" } }, "outputs": [ @@ -137,8 +137,8 @@ "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2021-06-10T21:32:29.034921Z", - "start_time": "2021-06-10T21:32:29.016422Z" + "end_time": "2021-10-04T08:50:55.153487Z", + "start_time": "2021-10-04T08:50:55.019212Z" } }, "outputs": [ @@ -168,8 +168,8 @@ "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2021-06-10T21:32:29.441008Z", - "start_time": "2021-06-10T21:32:29.431270Z" + "end_time": "2021-10-04T08:50:55.277022Z", + "start_time": "2021-10-04T08:50:55.162277Z" } }, "outputs": [ @@ -203,9 +203,10 @@ "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2021-06-10T21:32:30.066200Z", - "start_time": "2021-06-10T21:32:30.053055Z" - } + "end_time": "2021-10-04T08:50:55.446456Z", + "start_time": "2021-10-04T08:50:55.281905Z" + }, + "scrolled": true }, "outputs": [ { @@ -238,6 +239,173 @@ "user_check(4) # Wrong entry" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## if-elif-else statements with logical operators\n", + "\n", + "We can avoid writing nested condition by using logical operator **`and`**." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### if-elif-else statements `and` Logical Operator\n", + "\n", + "**Syntax:**\n", + "\n", + "```py\n", + "if condition and condition:\n", + " code\n", + "```" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T08:50:55.556809Z", + "start_time": "2021-10-04T08:50:55.453294Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A is zero\n" + ] + } + ], + "source": [ + "a = 0\n", + "if a > 0 and a % 2 == 0:\n", + " print('A is an even and positive integer')\n", + "elif a > 0 and a % 2 != 0:\n", + " print('A is a positive integer')\n", + "elif a == 0:\n", + " print('A is zero')\n", + "else:\n", + " print('A is negative')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### if-elif-else statements `or` Logical Operator\n", + "\n", + "**Syntax:**\n", + "\n", + "```py\n", + "if condition or condition:\n", + " code\n", + "```" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T08:50:55.708176Z", + "start_time": "2021-10-04T08:50:55.559738Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Access denied!\n" + ] + } + ], + "source": [ + "user = 'Arthur'\n", + "access_level = 3\n", + "if user == 'admin' or access_level >= 4:\n", + " print('Access granted!')\n", + "else:\n", + " print('Access denied!')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 💻 Exercises ➞ List\n", + "\n", + "### Exercises ➞ Level 1\n", + "\n", + "1. Get two numbers from the user using input prompt. If **`num_1`** is greater than **`num_2`** return **`num_1`** is greater than **`num_2`**, if **`num_1`** is less **`num_2`** return **`num_1`** is smaller than **`num_2`**, else **`num_1`** is equal to **`num_2`**. Output:\n", + "\n", + "```sh\n", + "Enter number one: 9\n", + "Enter number two: 6\n", + "9 is greater than 6\n", + "```\n", + "\n", + "### Exercises ➞ Level 2\n", + "\n", + "1. Write a code which gives grade to students according to theirs scores:\n", + " \n", + "```py\n", + " 80-100, A\n", + " 70-89, B\n", + " 60-69, C\n", + " 50-59, D\n", + " 0-49, F\n", + "```\n", + "\n", + "2. Check if the season is Autumn, Winter, Spring or Summer. \n", + " - If the user input is:\n", + " - September, October or November, the season is Autumn.\n", + " - December, January or February, the season is Winter.\n", + " - March, April or May, the season is Spring\n", + " - June, July or August, the season is Summer\n", + "\n", + "\n", + "3. The following list contains some fruits:\n", + " - If a fruit doesn't exist in the list add the fruit to the list and print the modified list. If the fruit exists print **`('That fruit already exist in the list')`** \n", + " \n", + "```py\n", + " fruits = ['banana', 'orange', 'mango', 'pear']\n", + "``` \n", + "\n", + "\n", + "### Exercises ➞ Level 3\n", + "\n", + " 1. Here we have a person dictionary. Feel free to modify it!\n", + " \n", + "```py\n", + " person={\n", + " 'first_name': 'Milaan',\n", + " 'last_name': 'Parmar',\n", + " 'age': 96,\n", + " 'country': 'Finland',\n", + " 'is_marred': True,\n", + " 'skills': ['Python', 'Matlab', 'R', 'C', 'C++'],\n", + " 'address': {\n", + " 'street': 'Space street',\n", + " 'zipcode': '02210'\n", + " }\n", + " }\n", + "```\n", + "\n", + " * Check if the person dictionary has skills key, if so print out the middle skill in the skills list.\n", + " * Check if the person dictionary has skills key, if so check if the person has 'Python' skill and print out the result.\n", + " * If a person skills has only Python and Matlab, print('He knows machine learning'), if the person skills has Python, and R print('He knows statistics'), if the person skills has C, and C++, Print('He knows software development'), else print('unknown title') - for more accurate results more conditions can be nested!\n", + " * If the person is married and if he lives in Finland, print the information in the following format:\n", + "\n", + "```py\n", + " Milaan Parmar lives in Finland. He is married.\n", + "```" + ] + }, { "cell_type": "code", "execution_count": null, @@ -274,7 +442,12 @@ "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, - "toc_position": {}, + "toc_position": { + "height": "calc(100% - 180px)", + "left": "10px", + "top": "150px", + "width": "204.797px" + }, "toc_section_display": true, "toc_window_display": false }, diff --git a/004_Python_Nested_if_statement.ipynb b/004_Python_Nested_if_statement.ipynb index e7e9229..17c7d42 100644 --- a/004_Python_Nested_if_statement.ipynb +++ b/004_Python_Nested_if_statement.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "\n", - "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", + "All the IPython Notebooks in **Python Flow Control Statements** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", "" ] }, diff --git a/005_Python_for_Loop.ipynb b/005_Python_for_Loop.ipynb index de6e99b..0f0bb14 100644 --- a/005_Python_for_Loop.ipynb +++ b/005_Python_for_Loop.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "\n", - "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", + "All the IPython Notebooks in **Python Flow Control Statements** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", "" ] }, @@ -34,7 +34,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## What is for loop in Python? \n", + "## What is `for` loop in Python? \n", "\n", "The for loop in Python is used to iterate over a sequence (**[string](https://github.com/milaan9/02_Python_Datatypes/blob/main/002_Python_String.ipynb)**, **[list](https://github.com/milaan9/02_Python_Datatypes/blob/main/003_Python_List.ipynb)**, **[dictionary](https://github.com/milaan9/02_Python_Datatypes/blob/main/005_Python_Dictionary.ipynb)**, **[set](https://github.com/milaan9/02_Python_Datatypes/blob/main/006_Python_Sets.ipynb)**, or **[tuple](https://github.com/milaan9/02_Python_Datatypes/blob/main/004_Python_Tuple.ipynb)**). Iterating over a sequence is called traversal." ] @@ -79,8 +79,8 @@ "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:19:57.228517Z", - "start_time": "2021-06-26T15:19:57.214846Z" + "end_time": "2021-10-04T12:09:49.251313Z", + "start_time": "2021-10-04T12:09:49.240575Z" } }, "outputs": [ @@ -97,7 +97,7 @@ } ], "source": [ - "# Example 1:\n", + "# Example 1: For loop \n", "\n", "words = ['one', 'two', 'three', 'four', 'five']\n", "\n", @@ -110,8 +110,8 @@ "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:19:58.273428Z", - "start_time": "2021-06-26T15:19:58.254876Z" + "end_time": "2021-10-04T12:09:49.282564Z", + "start_time": "2021-10-04T12:09:49.259620Z" } }, "outputs": [ @@ -166,8 +166,8 @@ "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:02.985782Z", - "start_time": "2021-06-26T15:20:02.968204Z" + "end_time": "2021-10-04T12:09:49.435886Z", + "start_time": "2021-10-04T12:09:49.292334Z" } }, "outputs": [ @@ -199,8 +199,8 @@ "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:03.828544Z", - "start_time": "2021-06-26T15:20:03.814876Z" + "end_time": "2021-10-04T12:09:49.633639Z", + "start_time": "2021-10-04T12:09:49.439794Z" }, "scrolled": true }, @@ -234,8 +234,8 @@ "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:04.421313Z", - "start_time": "2021-06-26T15:20:04.411551Z" + "end_time": "2021-10-04T12:09:49.908542Z", + "start_time": "2021-10-04T12:09:49.640473Z" }, "scrolled": false }, @@ -269,8 +269,8 @@ "execution_count": 6, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:06.028717Z", - "start_time": "2021-06-26T15:20:06.015050Z" + "end_time": "2021-10-04T12:09:50.137547Z", + "start_time": "2021-10-04T12:09:49.913425Z" }, "scrolled": true }, @@ -299,8 +299,8 @@ "execution_count": 7, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:09.633664Z", - "start_time": "2021-06-26T15:20:09.622924Z" + "end_time": "2021-10-04T12:09:50.259614Z", + "start_time": "2021-10-04T12:09:50.141453Z" } }, "outputs": [ @@ -330,8 +330,8 @@ "execution_count": 8, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:10.711777Z", - "start_time": "2021-06-26T15:20:10.687367Z" + "end_time": "2021-10-04T12:09:50.396821Z", + "start_time": "2021-10-04T12:09:50.262548Z" }, "scrolled": true }, @@ -390,8 +390,8 @@ "execution_count": 9, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:11.756688Z", - "start_time": "2021-06-26T15:20:11.743020Z" + "end_time": "2021-10-04T12:09:50.534518Z", + "start_time": "2021-10-04T12:09:50.399756Z" } }, "outputs": [ @@ -448,8 +448,8 @@ "execution_count": 10, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:13.519364Z", - "start_time": "2021-06-26T15:20:13.494956Z" + "end_time": "2021-10-04T12:09:50.657566Z", + "start_time": "2021-10-04T12:09:50.539403Z" } }, "outputs": [ @@ -499,9 +499,10 @@ "execution_count": 11, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:14.893374Z", - "start_time": "2021-06-26T15:20:14.881658Z" - } + "end_time": "2021-10-04T12:09:50.793310Z", + "start_time": "2021-10-04T12:09:50.666842Z" + }, + "scrolled": true }, "outputs": [ { @@ -540,8 +541,46 @@ "execution_count": 12, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:16.235158Z", - "start_time": "2021-06-26T15:20:16.222466Z" + "end_time": "2021-10-04T12:09:50.991550Z", + "start_time": "2021-10-04T12:09:50.796727Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "10\n", + "The loop stops at 10\n" + ] + } + ], + "source": [ + "# Example 2:\n", + "\n", + "for number in range(11):\n", + " print(number) # prints 0 to 10, not including 11\n", + "else:\n", + " print('The loop stops at', number)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:09:51.159520Z", + "start_time": "2021-10-04T12:09:50.996435Z" } }, "outputs": [ @@ -559,7 +598,7 @@ } ], "source": [ - "# Example 2: Else block in for loop\n", + "# Example 3: Else block in for loop\n", "\n", "for i in range(1, 6):\n", " print(i)\n", @@ -576,11 +615,11 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:17.390420Z", - "start_time": "2021-06-26T15:20:17.382611Z" + "end_time": "2021-10-04T12:09:51.312349Z", + "start_time": "2021-10-04T12:09:51.162449Z" } }, "outputs": [ @@ -593,7 +632,7 @@ } ], "source": [ - "# Example 3:\n", + "# Example 4:\n", "\n", "student_name = 'Arthur'\n", "\n", @@ -609,11 +648,11 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:18.107699Z", - "start_time": "2021-06-26T15:20:18.095006Z" + "end_time": "2021-10-04T12:09:51.403663Z", + "start_time": "2021-10-04T12:09:51.315770Z" } }, "outputs": [ @@ -627,7 +666,7 @@ } ], "source": [ - "# Example 4:\n", + "# Example 5:\n", "\n", "count = 0\n", "for i in range(1, 6):\n", @@ -662,11 +701,11 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:19.934827Z", - "start_time": "2021-06-26T15:20:19.920184Z" + "end_time": "2021-10-04T12:09:51.556493Z", + "start_time": "2021-10-04T12:09:51.407569Z" } }, "outputs": [ @@ -674,13 +713,53 @@ "name": "stdout", "output_type": "stream", "text": [ - "Pink\n" + "0\n", + "1\n", + "2\n", + "3\n" ] } ], "source": [ "# Example 1:\n", "\n", + "numbers = (0,1,2,3,4,5)\n", + "for number in numbers:\n", + " print(number)\n", + " if number == 3:\n", + " break" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Explanation:**\n", + "\n", + "In the above example, the loop stops when it reaches 3." + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:09:51.709323Z", + "start_time": "2021-10-04T12:09:51.561377Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pink\n" + ] + } + ], + "source": [ + "# Example 2:\n", + "\n", "color = ['Green', 'Pink', 'Blue']\n", "for i in color:\n", " if(i == 'Pink'):\n", @@ -699,11 +778,11 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 18, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:20.715093Z", - "start_time": "2021-06-26T15:20:20.694590Z" + "end_time": "2021-10-04T12:09:51.861668Z", + "start_time": "2021-10-04T12:09:51.712254Z" } }, "outputs": [ @@ -720,7 +799,7 @@ } ], "source": [ - "# Example 2:\n", + "# Example 3:\n", "\n", "numbers = [1, 4, 7, 8, 15, 20, 35, 45, 55]\n", "for i in numbers:\n", @@ -733,11 +812,11 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 19, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:21.246338Z", - "start_time": "2021-06-26T15:20:21.232668Z" + "end_time": "2021-10-04T12:09:52.014500Z", + "start_time": "2021-10-04T12:09:51.870458Z" }, "scrolled": true }, @@ -760,7 +839,7 @@ } ], "source": [ - "# Example 3:\n", + "# Example 4:\n", "\n", "for i in range(5):\n", " for j in range(5):\n", @@ -789,11 +868,11 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 20, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:22.523672Z", - "start_time": "2021-06-26T15:20:22.503164Z" + "end_time": "2021-10-04T12:09:52.152683Z", + "start_time": "2021-10-04T12:09:52.017432Z" } }, "outputs": [ @@ -826,11 +905,61 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 21, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:09:52.274755Z", + "start_time": "2021-10-04T12:09:52.155615Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "Next number should be 1\n", + "1\n", + "Next number should be 2\n", + "2\n", + "Next number should be 3\n", + "3\n", + "4\n", + "Next number should be 5\n", + "5\n", + "loop's end\n", + "outside the loop\n" + ] + } + ], + "source": [ + "# Example 2:\n", + "\n", + "numbers = (0,1,2,3,4,5)\n", + "for number in numbers:\n", + " print(number)\n", + " if number == 3:\n", + " continue\n", + " print('Next number should be ', number + 1) if number != 5 else print(\"loop's end\") # for short hand conditions need both if and else statements\n", + "print('outside the loop')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Explanation:**\n", + "\n", + "In the example above, if the number equals 3, the step **after** the condition (but inside the loop) is skipped and the execution of the loop continues if there are any iterations left." + ] + }, + { + "cell_type": "code", + "execution_count": 22, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:23.975801Z", - "start_time": "2021-06-26T15:20:23.959205Z" + "end_time": "2021-10-04T12:09:52.366553Z", + "start_time": "2021-10-04T12:09:52.277686Z" } }, "outputs": [ @@ -848,7 +977,7 @@ } ], "source": [ - "# Example 2:\n", + "# Example 3:\n", "\n", "first = [3, 6, 9]\n", "second = [3, 6, 9]\n", @@ -872,11 +1001,11 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:25.132041Z", - "start_time": "2021-06-26T15:20:25.119350Z" + "end_time": "2021-10-04T12:09:52.488622Z", + "start_time": "2021-10-04T12:09:52.369485Z" } }, "outputs": [ @@ -889,7 +1018,7 @@ } ], "source": [ - "# Example 3:\n", + "# Example 4:\n", "\n", "name = \"mariya mennen\"\n", "count = 0\n", @@ -913,17 +1042,34 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:26.147657Z", - "start_time": "2021-06-26T15:20:26.142777Z" + "end_time": "2021-10-04T12:09:52.625830Z", + "start_time": "2021-10-04T12:09:52.493506Z" } }, "outputs": [], "source": [ "# Example 1:\n", "\n", + "for number in range(6):\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:09:52.747899Z", + "start_time": "2021-10-04T12:09:52.633640Z" + } + }, + "outputs": [], + "source": [ + "# Example 2:\n", + "\n", "num = [1, 4, 5, 3, 7, 8]\n", "for i in num:\n", " # calculate multiplication in future if required\n", @@ -957,11 +1103,11 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 26, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:27.628597Z", - "start_time": "2021-06-26T15:20:27.607116Z" + "end_time": "2021-10-04T12:09:52.871924Z", + "start_time": "2021-10-04T12:09:52.752784Z" } }, "outputs": [ @@ -995,11 +1141,11 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 27, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:28.455739Z", - "start_time": "2021-06-26T15:20:28.439141Z" + "end_time": "2021-10-04T12:09:53.008641Z", + "start_time": "2021-10-04T12:09:52.875832Z" } }, "outputs": [ @@ -1038,11 +1184,11 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 28, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:29.267253Z", - "start_time": "2021-06-26T15:20:29.239914Z" + "end_time": "2021-10-04T12:09:53.129735Z", + "start_time": "2021-10-04T12:09:53.015969Z" } }, "outputs": [ @@ -1127,11 +1273,11 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 29, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:30.735014Z", - "start_time": "2021-06-26T15:20:30.711577Z" + "end_time": "2021-10-04T12:09:53.208838Z", + "start_time": "2021-10-04T12:09:53.132667Z" } }, "outputs": [ @@ -1177,11 +1323,54 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 30, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:31.327781Z", - "start_time": "2021-06-26T15:20:31.318992Z" + "end_time": "2021-10-04T12:09:53.312842Z", + "start_time": "2021-10-04T12:09:53.211769Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Python\n", + "Matlab\n", + "R\n", + "C\n", + "C++\n" + ] + } + ], + "source": [ + "# Example 1:\n", + "\n", + "person = {\n", + " 'first_name':'Milaan',\n", + " 'last_name':'Parmar',\n", + " 'age':96,\n", + " 'country':'Finland',\n", + " 'is_marred':True,\n", + " 'skills':['Python', 'Matlab', 'R', 'C', 'C++'],\n", + " 'address':{\n", + " 'street':'Space street',\n", + " 'zipcode':'02210'\n", + " }\n", + "}\n", + "for key in person:\n", + " if key == 'skills':\n", + " for skill in person['skills']:\n", + " print(skill)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:09:53.465185Z", + "start_time": "2021-10-04T12:09:53.315774Z" } }, "outputs": [ @@ -1220,11 +1409,11 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 32, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:31.984022Z", - "start_time": "2021-06-26T15:20:31.961565Z" + "end_time": "2021-10-04T12:09:53.556006Z", + "start_time": "2021-10-04T12:09:53.468116Z" }, "code_folding": [] }, @@ -1252,11 +1441,11 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 33, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:32.326796Z", - "start_time": "2021-06-26T15:20:32.317030Z" + "end_time": "2021-10-04T12:09:53.571631Z", + "start_time": "2021-10-04T12:09:53.558938Z" } }, "outputs": [ @@ -1281,11 +1470,11 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 34, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:32.842413Z", - "start_time": "2021-06-26T15:20:32.825816Z" + "end_time": "2021-10-04T12:09:53.678564Z", + "start_time": "2021-10-04T12:09:53.576026Z" } }, "outputs": [ @@ -1356,11 +1545,11 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 35, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:33.467407Z", - "start_time": "2021-06-26T15:20:33.455691Z" + "end_time": "2021-10-04T12:09:53.800634Z", + "start_time": "2021-10-04T12:09:53.681496Z" } }, "outputs": [ @@ -1377,7 +1566,7 @@ } ], "source": [ - "# Example 1:\n", + "# Example 1: Method 1\n", "\n", "rows = 5\n", "for i in range(1, rows + 1): # outer loop \n", @@ -1388,11 +1577,49 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 36, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:10:19.154180Z", + "start_time": "2021-10-04T12:09:53.805520Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "How many rows? 5\n", + "* \n", + "* * \n", + "* * * \n", + "* * * * \n", + "* * * * * \n" + ] + } + ], + "source": [ + "# Example 1: Method 2 - Print Floyd Triangle with user input\n", + "\t\t\n", + "\n", + "ran = input(\"How many rows? \")\n", + "\n", + "rang = int(ran)\n", + "k = 1\n", + "for i in range(1, rang+1):\n", + " for j in range(1, i+1):\n", + " print(\"*\", end=\" \")\n", + " k = k + 1\n", + " print()" + ] + }, + { + "cell_type": "code", + "execution_count": 37, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:33.825803Z", - "start_time": "2021-06-26T15:20:33.816038Z" + "end_time": "2021-10-04T12:10:19.169316Z", + "start_time": "2021-10-04T12:10:19.157142Z" }, "scrolled": true }, @@ -1420,11 +1647,11 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 38, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:34.091422Z", - "start_time": "2021-06-26T15:20:34.073847Z" + "end_time": "2021-10-04T12:10:19.338754Z", + "start_time": "2021-10-04T12:10:19.171271Z" } }, "outputs": [ @@ -1453,11 +1680,11 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 39, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:34.247671Z", - "start_time": "2021-06-26T15:20:34.234002Z" + "end_time": "2021-10-04T12:10:19.539923Z", + "start_time": "2021-10-04T12:10:19.342658Z" } }, "outputs": [ @@ -1487,11 +1714,11 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 40, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:34.450794Z", - "start_time": "2021-06-26T15:20:34.426385Z" + "end_time": "2021-10-04T12:10:19.693243Z", + "start_time": "2021-10-04T12:10:19.549688Z" } }, "outputs": [ @@ -1519,11 +1746,11 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 41, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:34.792590Z", - "start_time": "2021-06-26T15:20:34.770129Z" + "end_time": "2021-10-04T12:10:19.953986Z", + "start_time": "2021-10-04T12:10:19.699105Z" }, "scrolled": false }, @@ -1551,11 +1778,11 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 42, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:35.057233Z", - "start_time": "2021-06-26T15:20:35.040634Z" + "end_time": "2021-10-04T12:10:20.121956Z", + "start_time": "2021-10-04T12:10:19.956919Z" }, "scrolled": true }, @@ -1577,7 +1804,7 @@ "'\\ni = 1 2 3 4 5 \\n\\n# loop 1\\nfor i = 1, range (1,0,-1): j=1\\ni = 1, print: 1 \\n\\n# loop 2\\nfor i =2, range (2,0,-1): j = 2,1\\ni = 2, print: 2,1\\n'" ] }, - "execution_count": 36, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } @@ -1605,11 +1832,11 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 43, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:35.307230Z", - "start_time": "2021-06-26T15:20:35.292586Z" + "end_time": "2021-10-04T12:10:20.245002Z", + "start_time": "2021-10-04T12:10:20.124886Z" }, "scrolled": true }, @@ -1637,11 +1864,11 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 44, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:35.588477Z", - "start_time": "2021-06-26T15:20:35.568950Z" + "end_time": "2021-10-04T12:10:20.398322Z", + "start_time": "2021-10-04T12:10:20.249887Z" }, "scrolled": true }, @@ -1670,11 +1897,11 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 45, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:35.837500Z", - "start_time": "2021-06-26T15:20:35.819923Z" + "end_time": "2021-10-04T12:10:20.521369Z", + "start_time": "2021-10-04T12:10:20.401256Z" } }, "outputs": [ @@ -1704,11 +1931,11 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 46, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:36.134372Z", - "start_time": "2021-06-26T15:20:36.111913Z" + "end_time": "2021-10-04T12:10:20.736215Z", + "start_time": "2021-10-04T12:10:20.526255Z" } }, "outputs": [ @@ -1729,7 +1956,7 @@ "'\\ni = 5 4 3 2 1 \\n\\n# loop 1\\nfor i = 5, range (0,5): j=5 4 3 2 1\\ni = 5, print: 5 5 5 5 5\\n\\n# loop 2\\nfor i = 4, range (0,4): j=4 3 2 1\\ni = 4, print: 4 4 4 4 \\n'" ] }, - "execution_count": 40, + "execution_count": 46, "metadata": {}, "output_type": "execute_result" } @@ -1757,11 +1984,11 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 47, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:36.414154Z", - "start_time": "2021-06-26T15:20:36.402441Z" + "end_time": "2021-10-04T12:10:20.873909Z", + "start_time": "2021-10-04T12:10:20.739145Z" }, "scrolled": true }, @@ -1789,11 +2016,11 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 48, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:36.742278Z", - "start_time": "2021-06-26T15:20:36.729582Z" + "end_time": "2021-10-04T12:10:21.094614Z", + "start_time": "2021-10-04T12:10:20.877817Z" }, "scrolled": false }, @@ -1815,7 +2042,7 @@ "'\\ni = 1 2 3 4 5 \\n\\n# loop 1\\nfor i = 1, range (5): j=0 1 2 3 4\\ni = 1, print: 1 2 3 4 5\\n\\n# loop 2\\nfor i = 2, range (4): j=0 1 2 3\\ni = 2, print: 1 2 3 4\\n\\n# loop 3\\nfor i = 3, range (3): j=0 1 2\\ni = 3, print: 1 2 3\\n\\n# loop 4\\nfor i = 4, range (2): j=0 1\\ni = 4, print: 1 2\\n\\n# loop 5\\nfor i = 5, range (1): j=0 \\ni = 5, print: 1 \\n'" ] }, - "execution_count": 42, + "execution_count": 48, "metadata": {}, "output_type": "execute_result" } @@ -1855,11 +2082,11 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 49, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:37.336018Z", - "start_time": "2021-06-26T15:20:37.323326Z" + "end_time": "2021-10-04T12:10:21.227425Z", + "start_time": "2021-10-04T12:10:21.103408Z" } }, "outputs": [], @@ -1878,11 +2105,11 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 50, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:37.463948Z", - "start_time": "2021-06-26T15:20:37.424890Z" + "end_time": "2021-10-04T12:10:21.427621Z", + "start_time": "2021-10-04T12:10:21.232310Z" } }, "outputs": [ @@ -1934,11 +2161,11 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 51, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:38.023512Z", - "start_time": "2021-06-26T15:20:38.008869Z" + "end_time": "2021-10-04T12:10:21.551647Z", + "start_time": "2021-10-04T12:10:21.431529Z" } }, "outputs": [ @@ -1977,11 +2204,11 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 52, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:38.695380Z", - "start_time": "2021-06-26T15:20:38.679759Z" + "end_time": "2021-10-04T12:10:21.719615Z", + "start_time": "2021-10-04T12:10:21.556531Z" } }, "outputs": [ @@ -2007,11 +2234,11 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 53, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:39.006902Z", - "start_time": "2021-06-26T15:20:38.987373Z" + "end_time": "2021-10-04T12:10:21.858284Z", + "start_time": "2021-10-04T12:10:21.723522Z" } }, "outputs": [ @@ -2034,11 +2261,11 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 54, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:39.272526Z", - "start_time": "2021-06-26T15:20:39.264713Z" + "end_time": "2021-10-04T12:10:21.997934Z", + "start_time": "2021-10-04T12:10:21.861219Z" } }, "outputs": [ @@ -2060,11 +2287,11 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 55, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:39.585020Z", - "start_time": "2021-06-26T15:20:39.564518Z" + "end_time": "2021-10-04T12:10:22.151254Z", + "start_time": "2021-10-04T12:10:22.000865Z" } }, "outputs": [ @@ -2098,11 +2325,11 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 56, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:40.193412Z", - "start_time": "2021-06-26T15:20:40.171932Z" + "end_time": "2021-10-04T12:10:22.335828Z", + "start_time": "2021-10-04T12:10:22.154187Z" } }, "outputs": [ @@ -2131,11 +2358,11 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 57, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:40.505908Z", - "start_time": "2021-06-26T15:20:40.492242Z" + "end_time": "2021-10-04T12:10:22.474496Z", + "start_time": "2021-10-04T12:10:22.338757Z" } }, "outputs": [ @@ -2171,11 +2398,55 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 58, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:41.301800Z", - "start_time": "2021-06-26T15:20:41.287156Z" + "end_time": "2021-10-04T12:10:22.613169Z", + "start_time": "2021-10-04T12:10:22.477429Z" + }, + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "P\n", + "y\n", + "t\n", + "h\n", + "o\n", + "n\n", + "P\n", + "y\n", + "t\n", + "h\n", + "o\n", + "n\n" + ] + } + ], + "source": [ + "# Example 1: For loop with string\n", + "\n", + "# Method 1:\n", + "language = 'Python'\n", + "for letter in language:\n", + " print(letter)\n", + "\n", + "# Method 2: using range() function\n", + "\n", + "for i in range(len(language)):\n", + " print(language[i])" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:10:22.721568Z", + "start_time": "2021-10-04T12:10:22.617079Z" } }, "outputs": [ @@ -2198,7 +2469,7 @@ } ], "source": [ - "# Example 1: Printing the elements of a string using for loop\n", + "# Example 2: Printing the elements of a string using for loop\n", "\n", "for i in 'Hello World':\n", " print(i)" @@ -2206,11 +2477,11 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 60, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:41.645548Z", - "start_time": "2021-06-26T15:20:41.638711Z" + "end_time": "2021-10-04T12:10:22.843641Z", + "start_time": "2021-10-04T12:10:22.724500Z" } }, "outputs": [ @@ -2223,7 +2494,7 @@ } ], "source": [ - "# Example 2: Access all characters of a string\n", + "# Example 3: Access all characters of a string\n", "\n", "name = \"Alan\"\n", "for i in name:\n", @@ -2232,11 +2503,11 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 61, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:41.988315Z", - "start_time": "2021-06-26T15:20:41.968788Z" + "end_time": "2021-10-04T12:10:22.967662Z", + "start_time": "2021-10-04T12:10:22.848523Z" } }, "outputs": [ @@ -2249,7 +2520,7 @@ } ], "source": [ - "# Example 3: Iterate string in reverse order\n", + "# Example 4: Iterate string in reverse order\n", "\n", "name = \"Alan\"\n", "for i in name[::-1]:\n", @@ -2258,11 +2529,11 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 62, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:42.347689Z", - "start_time": "2021-06-26T15:20:42.339879Z" + "end_time": "2021-10-04T12:10:23.120985Z", + "start_time": "2021-10-04T12:10:22.971571Z" } }, "outputs": [ @@ -2275,7 +2546,7 @@ } ], "source": [ - "# Example 4: Iterate over a particular set of characters in string\n", + "# Example 5: Iterate over a particular set of characters in string\n", "\n", "name = \"Alan Watson\"\n", "for char in name[2:7:1]:\n", @@ -2284,13 +2555,13 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 63, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:42.690456Z", - "start_time": "2021-06-26T15:20:42.673861Z" + "end_time": "2021-10-04T12:10:23.244033Z", + "start_time": "2021-10-04T12:10:23.123915Z" }, - "scrolled": true + "scrolled": false }, "outputs": [ { @@ -2319,7 +2590,7 @@ } ], "source": [ - "# Example 5: Iterate over words in a sentence using the `split()` function.\n", + "# Example 6: Iterate over words in a sentence using the `split()` function.\n", "\n", "dialogue = \"Remember, Red, hope is a good thing, maybe the best of things, and no good thing ever dies\"\n", "# split on whitespace\n", @@ -2329,11 +2600,11 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 64, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:43.049828Z", - "start_time": "2021-06-26T15:20:43.035185Z" + "end_time": "2021-10-04T12:10:23.352429Z", + "start_time": "2021-10-04T12:10:23.246960Z" } }, "outputs": [ @@ -2349,7 +2620,7 @@ } ], "source": [ - "# Example 6:\n", + "# Example 7:\n", "\n", "for ch in 'abc':\n", " print(ch)\n", @@ -2380,11 +2651,11 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 65, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:43.752945Z", - "start_time": "2021-06-26T15:20:43.735371Z" + "end_time": "2021-10-04T12:10:23.476453Z", + "start_time": "2021-10-04T12:10:23.356337Z" } }, "outputs": [ @@ -2410,11 +2681,11 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 66, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:44.126966Z", - "start_time": "2021-06-26T15:20:44.112321Z" + "end_time": "2021-10-04T12:10:23.617078Z", + "start_time": "2021-10-04T12:10:23.480360Z" }, "scrolled": true }, @@ -2436,13 +2707,13 @@ "[None, None, None, None, None]" ] }, - "execution_count": 59, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "# Example 1: Iterate over a list Method 2 (list comprehension)\n", + "# Example 2: Iterate over a list Method 2 (list comprehension)\n", "\n", "numbers = [1, 2, 3, 6, 9]\n", "[print(i) for i in numbers]" @@ -2450,11 +2721,11 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 67, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:44.548837Z", - "start_time": "2021-06-26T15:20:44.533215Z" + "end_time": "2021-10-04T12:10:23.738173Z", + "start_time": "2021-10-04T12:10:23.620986Z" } }, "outputs": [ @@ -2471,7 +2742,7 @@ } ], "source": [ - "# Example 2: Iterate over a list using a for loop and range.\n", + "# Example 3: Iterate over a list using a for loop and range.\n", "\n", "numbers = [1, 2, 3, 6, 9]\n", "size = len(numbers)\n", @@ -2481,11 +2752,11 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 68, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:45.016606Z", - "start_time": "2021-06-26T15:20:45.003915Z" + "end_time": "2021-10-04T12:10:23.846571Z", + "start_time": "2021-10-04T12:10:23.741102Z" }, "scrolled": true }, @@ -2503,7 +2774,7 @@ } ], "source": [ - "# Example 3: printing the elements of a list using for loop\n", + "# Example 4: printing the elements of a list using for loop\n", "\n", "even_numbers = [2, 4, 6, 8, 10] # list with 5 elements\n", "for i in even_numbers:\n", @@ -2512,11 +2783,11 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 69, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:45.437014Z", - "start_time": "2021-06-26T15:20:45.426272Z" + "end_time": "2021-10-04T12:10:24.000869Z", + "start_time": "2021-10-04T12:10:23.850479Z" } }, "outputs": [ @@ -2531,7 +2802,7 @@ } ], "source": [ - "# Example 4: printing the elements of a list using for loop\n", + "# Example 5: printing the elements of a list using for loop\n", "\n", "list = [60, \"HelloWorld\", 90.96]\n", "for i in list:\n", @@ -2540,11 +2811,11 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 70, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:45.874509Z", - "start_time": "2021-06-26T15:20:45.856933Z" + "end_time": "2021-10-04T12:10:24.141492Z", + "start_time": "2021-10-04T12:10:24.023330Z" } }, "outputs": [ @@ -2557,7 +2828,7 @@ } ], "source": [ - "# Example 5: Program to find the sum of all numbers stored in a list\n", + "# Example 6: Program to find the sum of all numbers stored in a list\n", "\n", "# List of numbers\n", "numbers = [6, 5, 3, 8, 4, 2, 5, 6, 11] # list with 9 elements\n", @@ -2574,11 +2845,11 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 71, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:46.326652Z", - "start_time": "2021-06-26T15:20:46.307123Z" + "end_time": "2021-10-04T12:10:24.306532Z", + "start_time": "2021-10-04T12:10:24.159071Z" } }, "outputs": [ @@ -2595,7 +2866,7 @@ } ], "source": [ - "# Example 6: Calculate the square of each number using for loop.\n", + "# Example 7: Calculate the square of each number using for loop.\n", "\n", "numbers = [1, 2, 3, 4, 5]\n", "# iterate over each element in list num\n", @@ -2614,11 +2885,11 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 72, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:47.295393Z", - "start_time": "2021-06-26T15:20:47.279772Z" + "end_time": "2021-10-04T12:10:24.413953Z", + "start_time": "2021-10-04T12:10:24.309463Z" } }, "outputs": [ @@ -2631,7 +2902,7 @@ } ], "source": [ - "# Example 7: Calculate the average of list of numbers\n", + "# Example 8: Calculate the average of list of numbers\n", "\n", "numbers = [10, 20, 30, 40, 50]\n", "\n", @@ -2647,11 +2918,11 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 73, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:47.825659Z", - "start_time": "2021-06-26T15:20:47.804179Z" + "end_time": "2021-10-04T12:10:24.553606Z", + "start_time": "2021-10-04T12:10:24.418839Z" } }, "outputs": [ @@ -2667,7 +2938,7 @@ } ], "source": [ - "# Example 8: Printing a list using range function\n", + "# Example 9: Printing a list using range function\n", "\n", "color = ['Green', 'Pink', 'Blue'] # list with total 3 elements\n", "print(len(color)) # print length of color\n", @@ -2677,12 +2948,13 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 74, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:48.263157Z", - "start_time": "2021-06-26T15:20:48.254369Z" - } + "end_time": "2021-10-04T12:10:24.569228Z", + "start_time": "2021-10-04T12:10:24.559462Z" + }, + "scrolled": true }, "outputs": [ { @@ -2696,13 +2968,62 @@ } ], "source": [ - "# Example 9: Printing a list using range function\n", + "# Example 10: Printing a list using range function\n", "\n", "list_of_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] # list with 3 elements\n", "for list1 in list_of_lists:\n", " print(list1)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Iterate Tuple using `for` loop\n", + "\n", + "**[Python list](https://github.com/milaan9/02_Python_Datatypes/blob/main/004_Python_Tuple.ipynb)** Only the difference is that list is enclosed between square bracket **`[]`**, tuple between parentheses **`()`** and we cannot change the elements of a tuple once it is assigned, i.e., **immutable** whereas we can change the elements of a list i.e., **mutable**.\n", + "\n", + "Below are the few examples of Python list.\n", + "\n", + "```python\n", + ">>> numers = (1,2,4,6,7)\n", + ">>> players = (\"Messi\", \"Ronaldo\", \"Neymar\")\n", + "```\n", + "Using a loop, we can perform various operations on the tuple. There are ways to iterate through elements in it. Here are some examples to help you understand better." + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:10:24.723523Z", + "start_time": "2021-10-04T12:10:24.572159Z" + }, + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n" + ] + } + ], + "source": [ + "# Example 1: For loop with tuple\n", + "\n", + "numbers = (0, 1, 2, 3, 4, 5)\n", + "for number in numbers:\n", + " print(number)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -2721,11 +3042,11 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 76, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:49.199670Z", - "start_time": "2021-06-26T15:20:49.191861Z" + "end_time": "2021-10-04T12:10:24.876845Z", + "start_time": "2021-10-04T12:10:24.727434Z" } }, "outputs": [ @@ -2749,11 +3070,11 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 77, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:50.026809Z", - "start_time": "2021-06-26T15:20:50.007282Z" + "end_time": "2021-10-04T12:10:25.062391Z", + "start_time": "2021-10-04T12:10:24.879776Z" } }, "outputs": [ @@ -2777,12 +3098,13 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 78, "metadata": { "ExecuteTime": { - "end_time": "2021-06-26T15:20:50.650826Z", - "start_time": "2021-06-26T15:20:50.640087Z" - } + "end_time": "2021-10-04T12:10:25.216690Z", + "start_time": "2021-10-04T12:10:25.065324Z" + }, + "scrolled": true }, "outputs": [ { @@ -2803,6 +3125,191 @@ " print(value)" ] }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:10:25.339735Z", + "start_time": "2021-10-04T12:10:25.221574Z" + }, + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "first_name\n", + "last_name\n", + "age\n", + "country\n", + "is_marred\n", + "skills\n", + "address\n", + "first_name Milaan\n", + "last_name Parmar\n", + "age 96\n", + "country Finland\n", + "is_marred True\n", + "skills ['Python', 'Matlab', 'R', 'C', 'C++']\n", + "address {'street': 'Space street', 'zipcode': '02210'}\n" + ] + } + ], + "source": [ + "# Example 4: For loop with dictionary\n", + "#Looping through a dictionary gives you the key of the dictionary.\n", + "\n", + "person = {\n", + " 'first_name':'Milaan',\n", + " 'last_name':'Parmar',\n", + " 'age':96,\n", + " 'country':'Finland',\n", + " 'is_marred':True,\n", + " 'skills':['Python', 'Matlab', 'R', 'C', 'C++'],\n", + " 'address':{\n", + " 'street':'Space street',\n", + " 'zipcode':'02210'\n", + " }\n", + "}\n", + "for key in person:\n", + " print(key)\n", + "\n", + "for key, value in person.items():\n", + " print(key, value) # this way we get both keys and values printed out" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Iterate Set using `for` loop\n", + "\n", + "**[Python sets](https://github.com/milaan9/02_Python_Datatypes/blob/main/006_Python_Sets.ipynb)** is an unordered collection of items. Every set element is unique (no duplicates) and must be immutable (cannot be changed).\n", + "\n", + "However, a set itself is **mutable**. We can add or remove items from it.\n", + "\n", + "```python\n", + ">>> my_set = {1, 2, 3}\n", + ">>> my_vaccine = {\"Penicillin\", \"Fleming\", \"1928\"}\n", + "```\n", + "\n", + "Sets can also be used to perform mathematical set operations like **union**, **intersection**, **symmetric difference**, etc." + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:10:25.509661Z", + "start_time": "2021-10-04T12:10:25.343645Z" + }, + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "GUava\n", + "Banana\n", + "Grape\n", + "Kiwi\n", + "Orange\n", + "Apple\n", + "Mango\n" + ] + } + ], + "source": [ + "# Example 6: For loop with set\n", + "\n", + "mix_fruits = {'Banana', 'Apple', 'Mango', 'Orange', 'GUava', 'Kiwi', 'Grape'}\n", + "for fruits in mix_fruits:\n", + " print(fruits)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 💻 Exercises ➞ List\n", + "\n", + "### Exercises ➞ Level 1\n", + "\n", + "1. Iterate 0 to 10 using **`for`** loop, do the same using **`while`** loop.\n", + "2. Iterate 10 to 0 using **`for`** loop, do the same using **`while`** loop.\n", + "3. Write a loop that makes seven calls to **`print()`**, so we get on the output the following triangle:\n", + "\n", + "```py\n", + "# # # # # # # #\n", + "# # # # # # # #\n", + "# # # # # # # #\n", + "# # # # # # # #\n", + "# # # # # # # #\n", + "# # # # # # # #\n", + "# # # # # # # #\n", + "# # # # # # # #\n", + "```\n", + "\n", + "4. Use nested loops to create the following:\n", + "\n", + "```py\n", + " #\n", + " ###\n", + " #####\n", + " #######\n", + " #########\n", + " ###########\n", + "#############\n", + "```\n", + "\n", + "5. Print the following pattern using loops\n", + "\n", + "```py\n", + " 0 x 0 = 0\n", + " 1 x 1 = 1\n", + " 2 x 2 = 4\n", + " 3 x 3 = 9\n", + " 4 x 4 = 16\n", + " 5 x 5 = 25\n", + " 6 x 6 = 36\n", + " 7 x 7 = 49\n", + " 8 x 8 = 64\n", + " 9 x 9 = 81\n", + " 10 x 10 = 100\n", + "```\n", + "\n", + "6. Iterate through the list, ['Python', 'Numpy','Pandas','Scikit', 'Pytorch'] using a **`for`** loop and print out the items.\n", + "7. Use **`for`** loop to iterate from 0 to 100 and print only even numbers\n", + "8. Use **`for`** loop to iterate from 0 to 100 and print only odd numbers\n", + " \n", + "### Exercises ➞ Level 2\n", + " \n", + "1. Use **`for`** loop to iterate from 0 to 100 and print the sum of all numbers.\n", + "\n", + "```py\n", + " The sum of all numbers is 5050.\n", + "```\n", + "\n", + "1. Use **`for`** loop to iterate from 0 to 100 and print the sum of all evens and the sum of all odds.\n", + "\n", + "```py\n", + " The sum of all evens is 2550. And the sum of all odds is 2500.\n", + "```\n", + "\n", + "### Exercises ➞ Level 3\n", + "\n", + "1. Go to the data folder and use the **[countries.py](https://github.com/Asabeneh/30-Days-Of-Python/blob/master/data/countries.py)** file. Loop through the countries and extract all the countries containing the word **`land`**.\n", + "1. This is a fruit list, ['banana', 'orange', 'mango', 'lemon'] reverse the order using loop.\n", + "2. Go to the data folder and use the **[countries_data.py](https://github.com/milaan9/03_Python_Flow_Control/blob/main/countries_details_data.py)** file. \n", + " 1. What are the total number of languages in the data\n", + " 2. Find the ten most spoken languages from the data\n", + " 3. Find the 10 most populated countries in the world" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/006_Python_while_Loop.ipynb b/006_Python_while_Loop.ipynb index 02dc4a9..36fad61 100644 --- a/006_Python_while_Loop.ipynb +++ b/006_Python_while_Loop.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "\n", - "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", + "All the IPython Notebooks in **Python Flow Control Statements** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", "" ] }, @@ -83,8 +83,8 @@ "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:23.934629Z", - "start_time": "2021-06-14T08:52:23.927796Z" + "end_time": "2021-10-04T12:15:18.052046Z", + "start_time": "2021-10-04T12:15:18.041303Z" } }, "outputs": [ @@ -114,8 +114,8 @@ "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:24.668023Z", - "start_time": "2021-06-14T08:52:24.647518Z" + "end_time": "2021-10-04T12:15:18.175091Z", + "start_time": "2021-10-04T12:15:18.059861Z" } }, "outputs": [ @@ -144,8 +144,8 @@ "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:25.267142Z", - "start_time": "2021-06-14T08:52:25.255427Z" + "end_time": "2021-10-04T12:15:18.297648Z", + "start_time": "2021-10-04T12:15:18.178999Z" }, "scrolled": false }, @@ -179,8 +179,8 @@ "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:27.189010Z", - "start_time": "2021-06-14T08:52:27.167527Z" + "end_time": "2021-10-04T12:15:18.406047Z", + "start_time": "2021-10-04T12:15:18.307417Z" } }, "outputs": [ @@ -210,8 +210,8 @@ "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:27.836467Z", - "start_time": "2021-06-14T08:52:27.815961Z" + "end_time": "2021-10-04T12:15:18.559855Z", + "start_time": "2021-10-04T12:15:18.409468Z" } }, "outputs": [ @@ -241,8 +241,8 @@ "execution_count": 6, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:29.455600Z", - "start_time": "2021-06-14T08:52:29.447790Z" + "end_time": "2021-10-04T12:15:18.747846Z", + "start_time": "2021-10-04T12:15:18.565720Z" }, "scrolled": true }, @@ -288,6 +288,36 @@ "Finally, the result is displayed." ] }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:15:18.913373Z", + "start_time": "2021-10-04T12:15:18.751753Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 \n" + ] + } + ], + "source": [ + "# Example 7: simple fibonacci series\n", + "# the sum of two elements defines the next set\n", + "\n", + "a, b = 0, 1\n", + "while b < 1000:\n", + " print(b, end = ' ', flush = True)\n", + " a, b = b, a + b\n", + "\n", + "print() # line ending" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -299,11 +329,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:37.765141Z", - "start_time": "2021-06-14T08:52:31.408720Z" + "end_time": "2021-10-04T12:15:26.656062Z", + "start_time": "2021-10-04T12:15:18.916304Z" } }, "outputs": [ @@ -340,11 +370,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:37.901851Z", - "start_time": "2021-06-14T08:52:37.875485Z" + "end_time": "2021-10-04T12:15:26.671686Z", + "start_time": "2021-10-04T12:15:26.660944Z" }, "scrolled": true }, @@ -382,11 +412,11 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:45.455039Z", - "start_time": "2021-06-14T08:52:45.442346Z" + "end_time": "2021-10-04T12:15:26.858208Z", + "start_time": "2021-10-04T12:15:26.674614Z" } }, "outputs": [ @@ -420,11 +450,11 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:48.045357Z", - "start_time": "2021-06-14T08:52:48.024854Z" + "end_time": "2021-10-04T12:15:26.980277Z", + "start_time": "2021-10-04T12:15:26.866021Z" }, "code_folding": [], "scrolled": true @@ -482,11 +512,53 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:15:27.086726Z", + "start_time": "2021-10-04T12:15:26.983211Z" + }, + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n" + ] + } + ], + "source": [ + "count = 0\n", + "while count < 5:\n", + " print(count)\n", + " count = count + 1\n", + "else:\n", + " print(count)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Explanation:**\n", + "\n", + "The above loop condition will be false when count is 5 and the loop stops, and execution starts the else statement. As a result 5 will be printed." + ] + }, + { + "cell_type": "code", + "execution_count": 13, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:49.752872Z", - "start_time": "2021-06-14T08:52:49.745062Z" + "end_time": "2021-10-04T12:15:27.224424Z", + "start_time": "2021-10-04T12:15:27.091608Z" } }, "outputs": [ @@ -517,11 +589,11 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 14, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:50.591736Z", - "start_time": "2021-06-14T08:52:50.583927Z" + "end_time": "2021-10-04T12:15:27.378230Z", + "start_time": "2021-10-04T12:15:27.231258Z" } }, "outputs": [ @@ -550,11 +622,11 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 15, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:52:51.204038Z", - "start_time": "2021-06-14T08:52:51.188413Z" + "end_time": "2021-10-04T12:15:27.503719Z", + "start_time": "2021-10-04T12:15:27.383113Z" }, "scrolled": true }, @@ -596,11 +668,11 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 16, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:01.391979Z", - "start_time": "2021-06-14T08:52:52.585381Z" + "end_time": "2021-10-04T12:15:34.325991Z", + "start_time": "2021-10-04T12:15:27.507624Z" } }, "outputs": [ @@ -608,8 +680,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Enter any number between 100 and 600 369\n", - "Given Number is correct 369\n" + "Enter any number between 100 and 600 555\n", + "Given Number is correct 555\n" ] } ], @@ -649,11 +721,51 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 17, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:15:34.341618Z", + "start_time": "2021-10-04T12:15:34.327947Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n" + ] + } + ], + "source": [ + "# Example 1:\n", + "\n", + "count = 0\n", + "while count < 5:\n", + " print(count)\n", + " count = count + 1\n", + " if count == 3:\n", + " break " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Explanation**: \n", + "\n", + "Here, the **`while`** loop runs until the value of the variable **`i`** is less than 5. But because of the **`break`** statement, the loop gets terminated when the value of the variable **`i`** is 3 and it prints 0, 1, 2" + ] + }, + { + "cell_type": "code", + "execution_count": 18, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:08.314316Z", - "start_time": "2021-06-14T08:53:08.298691Z" + "end_time": "2021-10-04T12:15:34.485175Z", + "start_time": "2021-10-04T12:15:34.343572Z" } }, "outputs": [ @@ -668,7 +780,7 @@ } ], "source": [ - "# Example 1:\n", + "# Example 2:\n", "\n", "list = [60, \"HelloWorld\", 90.45, 50, 67.23, \"Python\"] # total 6 elements\n", "i = 0\n", @@ -690,11 +802,11 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:09.871435Z", - "start_time": "2021-06-14T08:53:09.849953Z" + "end_time": "2021-10-04T12:15:34.639958Z", + "start_time": "2021-10-04T12:15:34.504703Z" } }, "outputs": [ @@ -707,7 +819,7 @@ } ], "source": [ - "# Example 2: Display each character from a string and if `a` character is number then stop the loop.\n", + "# Example 3: Display each character from a string and if `a` character is number then stop the loop.\n", "\n", "name = 'Alan99White'\n", "size = len(name)\n", @@ -735,11 +847,63 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, + "metadata": { + "ExecuteTime": { + "end_time": "2021-10-04T12:15:43.254714Z", + "start_time": "2021-10-04T12:15:34.653630Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n" + ] + }, + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[0mcount\u001b[0m \u001b[1;33m<\u001b[0m \u001b[1;36m5\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mcount\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m3\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mcontinue\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcount\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], + "source": [ + "# Example 1:\n", + "\n", + "count = 0\n", + "while count < 5:\n", + " if count == 3:\n", + " continue \n", + " else:\n", + " print(count)\n", + " count = count + 1 " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Explanation:**\n", + "\n", + "The above **`while`** loop only prints 0, 1, 2 and 4 (skips 3)." + ] + }, + { + "cell_type": "code", + "execution_count": 21, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:11.585296Z", - "start_time": "2021-06-14T08:53:11.574556Z" + "end_time": "2021-10-04T12:15:48.259605Z", + "start_time": "2021-10-04T12:15:48.244468Z" }, "code_folding": [] }, @@ -757,7 +921,7 @@ } ], "source": [ - "# Example 1: printing odd numbers less than `n`\n", + "# Example 2: printing odd numbers less than `n`\n", "\n", "n=10\n", "i = 1\n", @@ -776,16 +940,16 @@ "source": [ "**Explanation:**\n", "\n", - "Here, the continue statement gets executed when the value of the variable is an even number. This simply means, whenever it is an even number, we simply skip all other statements and execute the next iteration." + "Here, the **`continue`** statement gets executed when the value of the variable is an even number. This simply means, whenever it is an even number, we simply skip all other statements and execute the next iteration." ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 22, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:13.071129Z", - "start_time": "2021-06-14T08:53:13.056484Z" + "end_time": "2021-10-04T12:15:49.635581Z", + "start_time": "2021-10-04T12:15:49.620932Z" } }, "outputs": [ @@ -798,7 +962,7 @@ } ], "source": [ - "# Example 2: Write a while loop to display only alphabets from a string.\n", + "# Example 3: Write a while loop to display only alphabets from a string.\n", "\n", "name = 'Alan99White'\n", "\n", @@ -825,11 +989,11 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 23, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:14.653641Z", - "start_time": "2021-06-14T08:53:14.638020Z" + "end_time": "2021-10-04T12:15:50.622885Z", + "start_time": "2021-10-04T12:15:50.610197Z" } }, "outputs": [], @@ -856,11 +1020,11 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 24, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:16.266917Z", - "start_time": "2021-06-14T08:53:16.257152Z" + "end_time": "2021-10-04T12:15:52.550625Z", + "start_time": "2021-10-04T12:15:52.539885Z" } }, "outputs": [ @@ -918,11 +1082,11 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 25, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:19.515435Z", - "start_time": "2021-06-14T08:53:19.497371Z" + "end_time": "2021-10-04T12:15:53.847500Z", + "start_time": "2021-10-04T12:15:53.826996Z" } }, "outputs": [ @@ -966,11 +1130,11 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 26, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:21.297164Z", - "start_time": "2021-06-14T08:53:21.281542Z" + "end_time": "2021-10-04T12:15:54.568693Z", + "start_time": "2021-10-04T12:15:54.547213Z" } }, "outputs": [ @@ -1015,11 +1179,11 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 27, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:23.125769Z", - "start_time": "2021-06-14T08:53:23.105263Z" + "end_time": "2021-10-04T12:15:55.309907Z", + "start_time": "2021-10-04T12:15:55.290378Z" } }, "outputs": [ @@ -1050,11 +1214,11 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 28, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:23.996860Z", - "start_time": "2021-06-14T08:53:23.985143Z" + "end_time": "2021-10-04T12:15:55.725921Z", + "start_time": "2021-10-04T12:15:55.702486Z" }, "scrolled": true }, @@ -1100,11 +1264,11 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 29, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:24.991975Z", - "start_time": "2021-06-14T08:53:24.979278Z" + "end_time": "2021-10-04T12:15:56.062835Z", + "start_time": "2021-10-04T12:15:56.043797Z" } }, "outputs": [ @@ -1145,11 +1309,11 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 30, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:26.480251Z", - "start_time": "2021-06-14T08:53:26.472433Z" + "end_time": "2021-10-04T12:15:56.695654Z", + "start_time": "2021-10-04T12:15:56.675146Z" } }, "outputs": [ @@ -1194,11 +1358,11 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 31, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:27.906995Z", - "start_time": "2021-06-14T08:53:27.889421Z" + "end_time": "2021-10-04T12:15:57.403172Z", + "start_time": "2021-10-04T12:15:57.389503Z" } }, "outputs": [ @@ -1227,11 +1391,11 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 32, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:28.690197Z", - "start_time": "2021-06-14T08:53:28.681409Z" + "end_time": "2021-10-04T12:15:58.048679Z", + "start_time": "2021-10-04T12:15:58.029154Z" } }, "outputs": [ @@ -1272,11 +1436,11 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 33, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:31.143799Z", - "start_time": "2021-06-14T08:53:31.121339Z" + "end_time": "2021-10-04T12:15:59.143411Z", + "start_time": "2021-10-04T12:15:59.132670Z" }, "scrolled": true }, @@ -1309,11 +1473,11 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 34, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:32.006098Z", - "start_time": "2021-06-14T08:53:31.985594Z" + "end_time": "2021-10-04T12:15:59.452490Z", + "start_time": "2021-10-04T12:15:59.431010Z" } }, "outputs": [ @@ -1345,11 +1509,11 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 35, "metadata": { "ExecuteTime": { - "end_time": "2021-06-14T08:53:32.913808Z", - "start_time": "2021-06-14T08:53:32.905023Z" + "end_time": "2021-10-04T12:15:59.835791Z", + "start_time": "2021-10-04T12:15:59.816265Z" } }, "outputs": [ diff --git a/007_Python_break_continue_pass_statements.ipynb b/007_Python_break_continue_pass_statements.ipynb index e583bb5..5487d06 100644 --- a/007_Python_break_continue_pass_statements.ipynb +++ b/007_Python_break_continue_pass_statements.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "\n", - "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", + "All the IPython Notebooks in **Python Flow Control Statements** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/03_Python_Flow_Control)**\n", "" ] }, diff --git a/README.md b/README.md index c992ab3..1796d0a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@

Last Commit -Last Commit + + Stars Badge @@ -14,7 +15,8 @@

-binder +binder +colab

# 03_Python_Flow_Control @@ -60,7 +62,7 @@ Decision Making statements are used when we want a set of instructions should be | 06 | **[Python_while_Loop](https://github.com/milaan9/03_Python_Flow_Control/blob/main/006_Python_while_Loop.ipynb)** | | 07 | **[Python_break_continue_pass_statements](https://github.com/milaan9/03_Python_Flow_Control/blob/main/007_Python_break_continue_pass_statements.ipynb)** | -These are online **read-only** versions. However you can "Run ▶" the code **online** by clicking here → binder +These are online **read-only** versions. However you can **`Run ▶`** the code **online** by clicking here ➞ binder --- @@ -68,25 +70,23 @@ These are online **read-only** versions. However you can "Run ▶" the code **on ### How can I thank you for writing and sharing this tutorial? 🌷 -You can ⭐ star this tutorial. Starring is free for you, but it tells me and other people that it was helpful and you like this tutorial. +You can Star Badge and Fork Badge Starring and Forking is free for you, but it tells me and other people that it was helpful and you like this tutorial. -Go [here](https://github.com/milaan9/03_Python_Flow_Control) if you aren't here already and click the "⭐ Star" button in the top right corner. You will be asked to create a GitHub account if you don't already have one. +Go [**`here`**](https://github.com/milaan9/03_Python_Flow_Control) if you aren't here already and click ➞ **`✰ Star`** and **`ⵖ Fork`** button in the top right corner. You'll be asked to create a GitHub account if you don't already have one. --- -### How can I read this tutorial without an Internet connection? 🤔 +### How can I read this tutorial without an Internet connection? GIF -1. Go [here](https://github.com/milaan9/03_Python_Flow_Control) if you aren't here already. - -2. Click the big green "Code" button in the top right of the page, then click "[Download ZIP](https://github.com/milaan9/03_Python_Flow_Control/archive/refs/heads/main.zip)". +1. Go [**`here`**](https://github.com/milaan9/03_Python_Flow_Control) and click the big green ➞ **`Code`** button in the top right of the page, then click ➞ [**`Download ZIP`**](https://github.com/milaan9/03_Python_Flow_Control/archive/refs/heads/main.zip). ![Download ZIP](img/dnld_rep.png) -3. Extract the ZIP and open it. Unfortunately I don't have any more specific instructions because how exactly this is done depends on which operating system you run. +2. Extract the ZIP and open it. Unfortunately I don't have any more specific instructions because how exactly this is done depends on which operating system you run. -4. Launch ipython notebook from the folder which contains the notebooks. Open each one of them +3. Launch ipython notebook from the folder which contains the notebooks. Open each one of them - `Kernel > Restart & Clear Output` + **`Kernel > Restart & Clear Output`** This will clear all the outputs and now you can understand each statement and learn interactively. diff --git a/countries_details_data.py b/countries_details_data.py new file mode 100644 index 0000000..f214fce --- /dev/null +++ b/countries_details_data.py @@ -0,0 +1,2620 @@ +[ + { + "name": "Afghanistan", + "capital": "Kabul", + "languages": [ + "Pashto", + "Uzbek", + "Turkmen" + ], + "population": 27657145, + "flag": "https://restcountries.eu/data/afg.svg", + "currency": "Afghan afghani" + }, + { + "name": "Åland Islands", + "capital": "Mariehamn", + "languages": [ + "Swedish" + ], + "population": 28875, + "flag": "https://restcountries.eu/data/ala.svg", + "currency": "Euro" + }, + { + "name": "Albania", + "capital": "Tirana", + "languages": [ + "Albanian" + ], + "population": 2886026, + "flag": "https://restcountries.eu/data/alb.svg", + "currency": "Albanian lek" + }, + { + "name": "Algeria", + "capital": "Algiers", + "languages": [ + "Arabic" + ], + "population": 40400000, + "flag": "https://restcountries.eu/data/dza.svg", + "currency": "Algerian dinar" + }, + { + "name": "American Samoa", + "capital": "Pago Pago", + "languages": [ + "English", + "Samoan" + ], + "population": 57100, + "flag": "https://restcountries.eu/data/asm.svg", + "currency": "United State Dollar" + }, + { + "name": "Andorra", + "capital": "Andorra la Vella", + "languages": [ + "Catalan" + ], + "population": 78014, + "flag": "https://restcountries.eu/data/and.svg", + "currency": "Euro" + }, + { + "name": "Angola", + "capital": "Luanda", + "languages": [ + "Portuguese" + ], + "population": 25868000, + "flag": "https://restcountries.eu/data/ago.svg", + "currency": "Angolan kwanza" + }, + { + "name": "Anguilla", + "capital": "The Valley", + "languages": [ + "English" + ], + "population": 13452, + "flag": "https://restcountries.eu/data/aia.svg", + "currency": "East Caribbean dollar" + }, + { + "name": "Antarctica", + "capital": "", + "languages": [ + "English", + "Russian" + ], + "population": 1000, + "flag": "https://restcountries.eu/data/ata.svg", + "currency": "Australian dollar" + }, + { + "name": "Antigua and Barbuda", + "capital": "Saint John's", + "languages": [ + "English" + ], + "population": 86295, + "flag": "https://restcountries.eu/data/atg.svg", + "currency": "East Caribbean dollar" + }, + { + "name": "Argentina", + "capital": "Buenos Aires", + "languages": [ + "Spanish", + "Guaraní" + ], + "population": 43590400, + "flag": "https://restcountries.eu/data/arg.svg", + "currency": "Argentine peso" + }, + { + "name": "Armenia", + "capital": "Yerevan", + "languages": [ + "Armenian", + "Russian" + ], + "population": 2994400, + "flag": "https://restcountries.eu/data/arm.svg", + "currency": "Armenian dram" + }, + { + "name": "Aruba", + "capital": "Oranjestad", + "languages": [ + "Dutch", + "(Eastern) Punjabi" + ], + "population": 107394, + "flag": "https://restcountries.eu/data/abw.svg", + "currency": "Aruban florin" + }, + { + "name": "Australia", + "capital": "Canberra", + "languages": [ + "English" + ], + "population": 24117360, + "flag": "https://restcountries.eu/data/aus.svg", + "currency": "Australian dollar" + }, + { + "name": "Austria", + "capital": "Vienna", + "languages": [ + "German" + ], + "population": 8725931, + "flag": "https://restcountries.eu/data/aut.svg", + "currency": "Euro" + }, + { + "name": "Azerbaijan", + "capital": "Baku", + "languages": [ + "Azerbaijani" + ], + "population": 9730500, + "flag": "https://restcountries.eu/data/aze.svg", + "currency": "Azerbaijani manat" + }, + { + "name": "Bahamas", + "capital": "Nassau", + "languages": [ + "English" + ], + "population": 378040, + "flag": "https://restcountries.eu/data/bhs.svg", + "currency": "Bahamian dollar" + }, + { + "name": "Bahrain", + "capital": "Manama", + "languages": [ + "Arabic" + ], + "population": 1404900, + "flag": "https://restcountries.eu/data/bhr.svg", + "currency": "Bahraini dinar" + }, + { + "name": "Bangladesh", + "capital": "Dhaka", + "languages": [ + "Bengali" + ], + "population": 161006790, + "flag": "https://restcountries.eu/data/bgd.svg", + "currency": "Bangladeshi taka" + }, + { + "name": "Barbados", + "capital": "Bridgetown", + "languages": [ + "English" + ], + "population": 285000, + "flag": "https://restcountries.eu/data/brb.svg", + "currency": "Barbadian dollar" + }, + { + "name": "Belarus", + "capital": "Minsk", + "languages": [ + "Belarusian", + "Russian" + ], + "population": 9498700, + "flag": "https://restcountries.eu/data/blr.svg", + "currency": "New Belarusian ruble" + }, + { + "name": "Belgium", + "capital": "Brussels", + "languages": [ + "Dutch", + "French", + "German" + ], + "population": 11319511, + "flag": "https://restcountries.eu/data/bel.svg", + "currency": "Euro" + }, + { + "name": "Belize", + "capital": "Belmopan", + "languages": [ + "English", + "Spanish" + ], + "population": 370300, + "flag": "https://restcountries.eu/data/blz.svg", + "currency": "Belize dollar" + }, + { + "name": "Benin", + "capital": "Porto-Novo", + "languages": [ + "French" + ], + "population": 10653654, + "flag": "https://restcountries.eu/data/ben.svg", + "currency": "West African CFA franc" + }, + { + "name": "Bermuda", + "capital": "Hamilton", + "languages": [ + "English" + ], + "population": 61954, + "flag": "https://restcountries.eu/data/bmu.svg", + "currency": "Bermudian dollar" + }, + { + "name": "Bhutan", + "capital": "Thimphu", + "languages": [ + "Dzongkha" + ], + "population": 775620, + "flag": "https://restcountries.eu/data/btn.svg", + "currency": "Bhutanese ngultrum" + }, + { + "name": "Bolivia (Plurinational State of)", + "capital": "Sucre", + "languages": [ + "Spanish", + "Aymara", + "Quechua" + ], + "population": 10985059, + "flag": "https://restcountries.eu/data/bol.svg", + "currency": "Bolivian boliviano" + }, + { + "name": "Bonaire, Sint Eustatius and Saba", + "capital": "Kralendijk", + "languages": [ + "Dutch" + ], + "population": 17408, + "flag": "https://restcountries.eu/data/bes.svg", + "currency": "United States dollar" + }, + { + "name": "Bosnia and Herzegovina", + "capital": "Sarajevo", + "languages": [ + "Bosnian", + "Croatian", + "Serbian" + ], + "population": 3531159, + "flag": "https://restcountries.eu/data/bih.svg", + "currency": "Bosnia and Herzegovina convertible mark" + }, + { + "name": "Botswana", + "capital": "Gaborone", + "languages": [ + "English", + "Tswana" + ], + "population": 2141206, + "flag": "https://restcountries.eu/data/bwa.svg", + "currency": "Botswana pula" + }, + { + "name": "Bouvet Island", + "capital": "", + "languages": [ + "Norwegian", + "Norwegian Bokmål", + "Norwegian Nynorsk" + ], + "population": 0, + "flag": "https://restcountries.eu/data/bvt.svg", + "currency": "Norwegian krone" + }, + { + "name": "Brazil", + "capital": "Brasília", + "languages": [ + "Portuguese" + ], + "population": 206135893, + "flag": "https://restcountries.eu/data/bra.svg", + "currency": "Brazilian real" + }, + { + "name": "British Indian Ocean Territory", + "capital": "Diego Garcia", + "languages": [ + "English" + ], + "population": 3000, + "flag": "https://restcountries.eu/data/iot.svg", + "currency": "United States dollar" + }, + { + "name": "United States Minor Outlying Islands", + "capital": "", + "languages": [ + "English" + ], + "population": 300, + "flag": "https://restcountries.eu/data/umi.svg", + "currency": "United States Dollar" + }, + { + "name": "Virgin Islands (British)", + "capital": "Road Town", + "languages": [ + "English" + ], + "population": 28514, + "flag": "https://restcountries.eu/data/vgb.svg", + "currency": "[D]" + }, + { + "name": "Virgin Islands (U.S.)", + "capital": "Charlotte Amalie", + "languages": [ + "English" + ], + "population": 114743, + "flag": "https://restcountries.eu/data/vir.svg", + "currency": "United States dollar" + }, + { + "name": "Brunei Darussalam", + "capital": "Bandar Seri Begawan", + "languages": [ + "Malay" + ], + "population": 411900, + "flag": "https://restcountries.eu/data/brn.svg", + "currency": "Brunei dollar" + }, + { + "name": "Bulgaria", + "capital": "Sofia", + "languages": [ + "Bulgarian" + ], + "population": 7153784, + "flag": "https://restcountries.eu/data/bgr.svg", + "currency": "Bulgarian lev" + }, + { + "name": "Burkina Faso", + "capital": "Ouagadougou", + "languages": [ + "French", + "Fula" + ], + "population": 19034397, + "flag": "https://restcountries.eu/data/bfa.svg", + "currency": "West African CFA franc" + }, + { + "name": "Burundi", + "capital": "Bujumbura", + "languages": [ + "French", + "Kirundi" + ], + "population": 10114505, + "flag": "https://restcountries.eu/data/bdi.svg", + "currency": "Burundian franc" + }, + { + "name": "Cambodia", + "capital": "Phnom Penh", + "languages": [ + "Khmer" + ], + "population": 15626444, + "flag": "https://restcountries.eu/data/khm.svg", + "currency": "Cambodian riel" + }, + { + "name": "Cameroon", + "capital": "Yaoundé", + "languages": [ + "English", + "French" + ], + "population": 22709892, + "flag": "https://restcountries.eu/data/cmr.svg", + "currency": "Central African CFA franc" + }, + { + "name": "Canada", + "capital": "Ottawa", + "languages": [ + "English", + "French" + ], + "population": 36155487, + "flag": "https://restcountries.eu/data/can.svg", + "currency": "Canadian dollar" + }, + { + "name": "Cabo Verde", + "capital": "Praia", + "languages": [ + "Portuguese" + ], + "population": 531239, + "flag": "https://restcountries.eu/data/cpv.svg", + "currency": "Cape Verdean escudo" + }, + { + "name": "Cayman Islands", + "capital": "George Town", + "languages": [ + "English" + ], + "population": 58238, + "flag": "https://restcountries.eu/data/cym.svg", + "currency": "Cayman Islands dollar" + }, + { + "name": "Central African Republic", + "capital": "Bangui", + "languages": [ + "French", + "Sango" + ], + "population": 4998000, + "flag": "https://restcountries.eu/data/caf.svg", + "currency": "Central African CFA franc" + }, + { + "name": "Chad", + "capital": "N'Djamena", + "languages": [ + "French", + "Arabic" + ], + "population": 14497000, + "flag": "https://restcountries.eu/data/tcd.svg", + "currency": "Central African CFA franc" + }, + { + "name": "Chile", + "capital": "Santiago", + "languages": [ + "Spanish" + ], + "population": 18191900, + "flag": "https://restcountries.eu/data/chl.svg", + "currency": "Chilean peso" + }, + { + "name": "China", + "capital": "Beijing", + "languages": [ + "Chinese" + ], + "population": 1377422166, + "flag": "https://restcountries.eu/data/chn.svg", + "currency": "Chinese yuan" + }, + { + "name": "Christmas Island", + "capital": "Flying Fish Cove", + "languages": [ + "English" + ], + "population": 2072, + "flag": "https://restcountries.eu/data/cxr.svg", + "currency": "Australian dollar" + }, + { + "name": "Cocos (Keeling) Islands", + "capital": "West Island", + "languages": [ + "English" + ], + "population": 550, + "flag": "https://restcountries.eu/data/cck.svg", + "currency": "Australian dollar" + }, + { + "name": "Colombia", + "capital": "Bogotá", + "languages": [ + "Spanish" + ], + "population": 48759958, + "flag": "https://restcountries.eu/data/col.svg", + "currency": "Colombian peso" + }, + { + "name": "Comoros", + "capital": "Moroni", + "languages": [ + "Arabic", + "French" + ], + "population": 806153, + "flag": "https://restcountries.eu/data/com.svg", + "currency": "Comorian franc" + }, + { + "name": "Congo", + "capital": "Brazzaville", + "languages": [ + "French", + "Lingala" + ], + "population": 4741000, + "flag": "https://restcountries.eu/data/cog.svg", + "currency": "Central African CFA franc" + }, + { + "name": "Congo (Democratic Republic of the)", + "capital": "Kinshasa", + "languages": [ + "French", + "Lingala", + "Kongo", + "Swahili", + "Luba-Katanga" + ], + "population": 85026000, + "flag": "https://restcountries.eu/data/cod.svg", + "currency": "Congolese franc" + }, + { + "name": "Cook Islands", + "capital": "Avarua", + "languages": [ + "English" + ], + "population": 18100, + "flag": "https://restcountries.eu/data/cok.svg", + "currency": "New Zealand dollar" + }, + { + "name": "Costa Rica", + "capital": "San José", + "languages": [ + "Spanish" + ], + "population": 4890379, + "flag": "https://restcountries.eu/data/cri.svg", + "currency": "Costa Rican colón" + }, + { + "name": "Croatia", + "capital": "Zagreb", + "languages": [ + "Croatian" + ], + "population": 4190669, + "flag": "https://restcountries.eu/data/hrv.svg", + "currency": "Croatian kuna" + }, + { + "name": "Cuba", + "capital": "Havana", + "languages": [ + "Spanish" + ], + "population": 11239004, + "flag": "https://restcountries.eu/data/cub.svg", + "currency": "Cuban convertible peso" + }, + { + "name": "Curaçao", + "capital": "Willemstad", + "languages": [ + "Dutch", + "(Eastern) Punjabi", + "English" + ], + "population": 154843, + "flag": "https://restcountries.eu/data/cuw.svg", + "currency": "Netherlands Antillean guilder" + }, + { + "name": "Cyprus", + "capital": "Nicosia", + "languages": [ + "Greek (modern)", + "Turkish", + "Armenian" + ], + "population": 847000, + "flag": "https://restcountries.eu/data/cyp.svg", + "currency": "Euro" + }, + { + "name": "Czech Republic", + "capital": "Prague", + "languages": [ + "Czech", + "Slovak" + ], + "population": 10558524, + "flag": "https://restcountries.eu/data/cze.svg", + "currency": "Czech koruna" + }, + { + "name": "Denmark", + "capital": "Copenhagen", + "languages": [ + "Danish" + ], + "population": 5717014, + "flag": "https://restcountries.eu/data/dnk.svg", + "currency": "Danish krone" + }, + { + "name": "Djibouti", + "capital": "Djibouti", + "languages": [ + "French", + "Arabic" + ], + "population": 900000, + "flag": "https://restcountries.eu/data/dji.svg", + "currency": "Djiboutian franc" + }, + { + "name": "Dominica", + "capital": "Roseau", + "languages": [ + "English" + ], + "population": 71293, + "flag": "https://restcountries.eu/data/dma.svg", + "currency": "East Caribbean dollar" + }, + { + "name": "Dominican Republic", + "capital": "Santo Domingo", + "languages": [ + "Spanish" + ], + "population": 10075045, + "flag": "https://restcountries.eu/data/dom.svg", + "currency": "Dominican peso" + }, + { + "name": "Ecuador", + "capital": "Quito", + "languages": [ + "Spanish" + ], + "population": 16545799, + "flag": "https://restcountries.eu/data/ecu.svg", + "currency": "United States dollar" + }, + { + "name": "Egypt", + "capital": "Cairo", + "languages": [ + "Arabic" + ], + "population": 91290000, + "flag": "https://restcountries.eu/data/egy.svg", + "currency": "Egyptian pound" + }, + { + "name": "El Salvador", + "capital": "San Salvador", + "languages": [ + "Spanish" + ], + "population": 6520675, + "flag": "https://restcountries.eu/data/slv.svg", + "currency": "United States dollar" + }, + { + "name": "Equatorial Guinea", + "capital": "Malabo", + "languages": [ + "Spanish", + "French" + ], + "population": 1222442, + "flag": "https://restcountries.eu/data/gnq.svg", + "currency": "Central African CFA franc" + }, + { + "name": "Eritrea", + "capital": "Asmara", + "languages": [ + "Tigrinya", + "Arabic", + "English" + ], + "population": 5352000, + "flag": "https://restcountries.eu/data/eri.svg", + "currency": "Eritrean nakfa" + }, + { + "name": "Estonia", + "capital": "Tallinn", + "languages": [ + "Estonian" + ], + "population": 1315944, + "flag": "https://restcountries.eu/data/est.svg", + "currency": "Euro" + }, + { + "name": "Ethiopia", + "capital": "Addis Ababa", + "languages": [ + "Amharic" + ], + "population": 92206005, + "flag": "https://restcountries.eu/data/eth.svg", + "currency": "Ethiopian birr" + }, + { + "name": "Falkland Islands (Malvinas)", + "capital": "Stanley", + "languages": [ + "English" + ], + "population": 2563, + "flag": "https://restcountries.eu/data/flk.svg", + "currency": "Falkland Islands pound" + }, + { + "name": "Faroe Islands", + "capital": "Tórshavn", + "languages": [ + "Faroese" + ], + "population": 49376, + "flag": "https://restcountries.eu/data/fro.svg", + "currency": "Danish krone" + }, + { + "name": "Fiji", + "capital": "Suva", + "languages": [ + "English", + "Fijian", + "Hindi", + "Urdu" + ], + "population": 867000, + "flag": "https://restcountries.eu/data/fji.svg", + "currency": "Fijian dollar" + }, + { + "name": "Finland", + "capital": "Helsinki", + "languages": [ + "Finnish", + "Swedish" + ], + "population": 5491817, + "flag": "https://restcountries.eu/data/fin.svg", + "currency": "Euro" + }, + { + "name": "France", + "capital": "Paris", + "languages": [ + "French" + ], + "population": 66710000, + "flag": "https://restcountries.eu/data/fra.svg", + "currency": "Euro" + }, + { + "name": "French Guiana", + "capital": "Cayenne", + "languages": [ + "French" + ], + "population": 254541, + "flag": "https://restcountries.eu/data/guf.svg", + "currency": "Euro" + }, + { + "name": "French Polynesia", + "capital": "Papeetē", + "languages": [ + "French" + ], + "population": 271800, + "flag": "https://restcountries.eu/data/pyf.svg", + "currency": "CFP franc" + }, + { + "name": "French Southern Territories", + "capital": "Port-aux-Français", + "languages": [ + "French" + ], + "population": 140, + "flag": "https://restcountries.eu/data/atf.svg", + "currency": "Euro" + }, + { + "name": "Gabon", + "capital": "Libreville", + "languages": [ + "French" + ], + "population": 1802278, + "flag": "https://restcountries.eu/data/gab.svg", + "currency": "Central African CFA franc" + }, + { + "name": "Gambia", + "capital": "Banjul", + "languages": [ + "English" + ], + "population": 1882450, + "flag": "https://restcountries.eu/data/gmb.svg", + "currency": "Gambian dalasi" + }, + { + "name": "Georgia", + "capital": "Tbilisi", + "languages": [ + "Georgian" + ], + "population": 3720400, + "flag": "https://restcountries.eu/data/geo.svg", + "currency": "Georgian Lari" + }, + { + "name": "Germany", + "capital": "Berlin", + "languages": [ + "German" + ], + "population": 81770900, + "flag": "https://restcountries.eu/data/deu.svg", + "currency": "Euro" + }, + { + "name": "Ghana", + "capital": "Accra", + "languages": [ + "English" + ], + "population": 27670174, + "flag": "https://restcountries.eu/data/gha.svg", + "currency": "Ghanaian cedi" + }, + { + "name": "Gibraltar", + "capital": "Gibraltar", + "languages": [ + "English" + ], + "population": 33140, + "flag": "https://restcountries.eu/data/gib.svg", + "currency": "Gibraltar pound" + }, + { + "name": "Greece", + "capital": "Athens", + "languages": [ + "Greek (modern)" + ], + "population": 10858018, + "flag": "https://restcountries.eu/data/grc.svg", + "currency": "Euro" + }, + { + "name": "Greenland", + "capital": "Nuuk", + "languages": [ + "Kalaallisut" + ], + "population": 55847, + "flag": "https://restcountries.eu/data/grl.svg", + "currency": "Danish krone" + }, + { + "name": "Grenada", + "capital": "St. George's", + "languages": [ + "English" + ], + "population": 103328, + "flag": "https://restcountries.eu/data/grd.svg", + "currency": "East Caribbean dollar" + }, + { + "name": "Guadeloupe", + "capital": "Basse-Terre", + "languages": [ + "French" + ], + "population": 400132, + "flag": "https://restcountries.eu/data/glp.svg", + "currency": "Euro" + }, + { + "name": "Guam", + "capital": "Hagåtña", + "languages": [ + "English", + "Chamorro", + "Spanish" + ], + "population": 184200, + "flag": "https://restcountries.eu/data/gum.svg", + "currency": "United States dollar" + }, + { + "name": "Guatemala", + "capital": "Guatemala City", + "languages": [ + "Spanish" + ], + "population": 16176133, + "flag": "https://restcountries.eu/data/gtm.svg", + "currency": "Guatemalan quetzal" + }, + { + "name": "Guernsey", + "capital": "St. Peter Port", + "languages": [ + "English", + "French" + ], + "population": 62999, + "flag": "https://restcountries.eu/data/ggy.svg", + "currency": "British pound" + }, + { + "name": "Guinea", + "capital": "Conakry", + "languages": [ + "French", + "Fula" + ], + "population": 12947000, + "flag": "https://restcountries.eu/data/gin.svg", + "currency": "Guinean franc" + }, + { + "name": "Guinea-Bissau", + "capital": "Bissau", + "languages": [ + "Portuguese" + ], + "population": 1547777, + "flag": "https://restcountries.eu/data/gnb.svg", + "currency": "West African CFA franc" + }, + { + "name": "Guyana", + "capital": "Georgetown", + "languages": [ + "English" + ], + "population": 746900, + "flag": "https://restcountries.eu/data/guy.svg", + "currency": "Guyanese dollar" + }, + { + "name": "Haiti", + "capital": "Port-au-Prince", + "languages": [ + "French", + "Haitian" + ], + "population": 11078033, + "flag": "https://restcountries.eu/data/hti.svg", + "currency": "Haitian gourde" + }, + { + "name": "Heard Island and McDonald Islands", + "capital": "", + "languages": [ + "English" + ], + "population": 0, + "flag": "https://restcountries.eu/data/hmd.svg", + "currency": "Australian dollar" + }, + { + "name": "Holy See", + "capital": "Rome", + "languages": [ + "Latin", + "Italian", + "French", + "German" + ], + "population": 451, + "flag": "https://restcountries.eu/data/vat.svg", + "currency": "Euro" + }, + { + "name": "Honduras", + "capital": "Tegucigalpa", + "languages": [ + "Spanish" + ], + "population": 8576532, + "flag": "https://restcountries.eu/data/hnd.svg", + "currency": "Honduran lempira" + }, + { + "name": "Hong Kong", + "capital": "City of Victoria", + "languages": [ + "English", + "Chinese" + ], + "population": 7324300, + "flag": "https://restcountries.eu/data/hkg.svg", + "currency": "Hong Kong dollar" + }, + { + "name": "Hungary", + "capital": "Budapest", + "languages": [ + "Hungarian" + ], + "population": 9823000, + "flag": "https://restcountries.eu/data/hun.svg", + "currency": "Hungarian forint" + }, + { + "name": "Iceland", + "capital": "Reykjavík", + "languages": [ + "Icelandic" + ], + "population": 334300, + "flag": "https://restcountries.eu/data/isl.svg", + "currency": "Icelandic króna" + }, + { + "name": "India", + "capital": "New Delhi", + "languages": [ + "Hindi", + "English" + ], + "population": 1295210000, + "flag": "https://restcountries.eu/data/ind.svg", + "currency": "Indian rupee" + }, + { + "name": "Indonesia", + "capital": "Jakarta", + "languages": [ + "Indonesian" + ], + "population": 258705000, + "flag": "https://restcountries.eu/data/idn.svg", + "currency": "Indonesian rupiah" + }, + { + "name": "Côte d'Ivoire", + "capital": "Yamoussoukro", + "languages": [ + "French" + ], + "population": 22671331, + "flag": "https://restcountries.eu/data/civ.svg", + "currency": "West African CFA franc" + }, + { + "name": "Iran (Islamic Republic of)", + "capital": "Tehran", + "languages": [ + "Persian (Farsi)" + ], + "population": 79369900, + "flag": "https://restcountries.eu/data/irn.svg", + "currency": "Iranian rial" + }, + { + "name": "Iraq", + "capital": "Baghdad", + "languages": [ + "Arabic", + "Kurdish" + ], + "population": 37883543, + "flag": "https://restcountries.eu/data/irq.svg", + "currency": "Iraqi dinar" + }, + { + "name": "Ireland", + "capital": "Dublin", + "languages": [ + "Irish", + "English" + ], + "population": 6378000, + "flag": "https://restcountries.eu/data/irl.svg", + "currency": "Euro" + }, + { + "name": "Isle of Man", + "capital": "Douglas", + "languages": [ + "English", + "Manx" + ], + "population": 84497, + "flag": "https://restcountries.eu/data/imn.svg", + "currency": "British pound" + }, + { + "name": "Israel", + "capital": "Jerusalem", + "languages": [ + "Hebrew (modern)", + "Arabic" + ], + "population": 8527400, + "flag": "https://restcountries.eu/data/isr.svg", + "currency": "Israeli new shekel" + }, + { + "name": "Italy", + "capital": "Rome", + "languages": [ + "Italian" + ], + "population": 60665551, + "flag": "https://restcountries.eu/data/ita.svg", + "currency": "Euro" + }, + { + "name": "Jamaica", + "capital": "Kingston", + "languages": [ + "English" + ], + "population": 2723246, + "flag": "https://restcountries.eu/data/jam.svg", + "currency": "Jamaican dollar" + }, + { + "name": "Japan", + "capital": "Tokyo", + "languages": [ + "Japanese" + ], + "population": 126960000, + "flag": "https://restcountries.eu/data/jpn.svg", + "currency": "Japanese yen" + }, + { + "name": "Jersey", + "capital": "Saint Helier", + "languages": [ + "English", + "French" + ], + "population": 100800, + "flag": "https://restcountries.eu/data/jey.svg", + "currency": "British pound" + }, + { + "name": "Jordan", + "capital": "Amman", + "languages": [ + "Arabic" + ], + "population": 9531712, + "flag": "https://restcountries.eu/data/jor.svg", + "currency": "Jordanian dinar" + }, + { + "name": "Kazakhstan", + "capital": "Astana", + "languages": [ + "Kazakh", + "Russian" + ], + "population": 17753200, + "flag": "https://restcountries.eu/data/kaz.svg", + "currency": "Kazakhstani tenge" + }, + { + "name": "Kenya", + "capital": "Nairobi", + "languages": [ + "English", + "Swahili" + ], + "population": 47251000, + "flag": "https://restcountries.eu/data/ken.svg", + "currency": "Kenyan shilling" + }, + { + "name": "Kiribati", + "capital": "South Tarawa", + "languages": [ + "English" + ], + "population": 113400, + "flag": "https://restcountries.eu/data/kir.svg", + "currency": "Australian dollar" + }, + { + "name": "Kuwait", + "capital": "Kuwait City", + "languages": [ + "Arabic" + ], + "population": 4183658, + "flag": "https://restcountries.eu/data/kwt.svg", + "currency": "Kuwaiti dinar" + }, + { + "name": "Kyrgyzstan", + "capital": "Bishkek", + "languages": [ + "Kyrgyz", + "Russian" + ], + "population": 6047800, + "flag": "https://restcountries.eu/data/kgz.svg", + "currency": "Kyrgyzstani som" + }, + { + "name": "Lao People's Democratic Republic", + "capital": "Vientiane", + "languages": [ + "Lao" + ], + "population": 6492400, + "flag": "https://restcountries.eu/data/lao.svg", + "currency": "Lao kip" + }, + { + "name": "Latvia", + "capital": "Riga", + "languages": [ + "Latvian" + ], + "population": 1961600, + "flag": "https://restcountries.eu/data/lva.svg", + "currency": "Euro" + }, + { + "name": "Lebanon", + "capital": "Beirut", + "languages": [ + "Arabic", + "French" + ], + "population": 5988000, + "flag": "https://restcountries.eu/data/lbn.svg", + "currency": "Lebanese pound" + }, + { + "name": "Lesotho", + "capital": "Maseru", + "languages": [ + "English", + "Southern Sotho" + ], + "population": 1894194, + "flag": "https://restcountries.eu/data/lso.svg", + "currency": "Lesotho loti" + }, + { + "name": "Liberia", + "capital": "Monrovia", + "languages": [ + "English" + ], + "population": 4615000, + "flag": "https://restcountries.eu/data/lbr.svg", + "currency": "Liberian dollar" + }, + { + "name": "Libya", + "capital": "Tripoli", + "languages": [ + "Arabic" + ], + "population": 6385000, + "flag": "https://restcountries.eu/data/lby.svg", + "currency": "Libyan dinar" + }, + { + "name": "Liechtenstein", + "capital": "Vaduz", + "languages": [ + "German" + ], + "population": 37623, + "flag": "https://restcountries.eu/data/lie.svg", + "currency": "Swiss franc" + }, + { + "name": "Lithuania", + "capital": "Vilnius", + "languages": [ + "Lithuanian" + ], + "population": 2872294, + "flag": "https://restcountries.eu/data/ltu.svg", + "currency": "Euro" + }, + { + "name": "Luxembourg", + "capital": "Luxembourg", + "languages": [ + "French", + "German", + "Luxembourgish" + ], + "population": 576200, + "flag": "https://restcountries.eu/data/lux.svg", + "currency": "Euro" + }, + { + "name": "Macao", + "capital": "", + "languages": [ + "Chinese", + "Portuguese" + ], + "population": 649100, + "flag": "https://restcountries.eu/data/mac.svg", + "currency": "Macanese pataca" + }, + { + "name": "Macedonia (the former Yugoslav Republic of)", + "capital": "Skopje", + "languages": [ + "Macedonian" + ], + "population": 2058539, + "flag": "https://restcountries.eu/data/mkd.svg", + "currency": "Macedonian denar" + }, + { + "name": "Madagascar", + "capital": "Antananarivo", + "languages": [ + "French", + "Malagasy" + ], + "population": 22434363, + "flag": "https://restcountries.eu/data/mdg.svg", + "currency": "Malagasy ariary" + }, + { + "name": "Malawi", + "capital": "Lilongwe", + "languages": [ + "English", + "Chichewa" + ], + "population": 16832910, + "flag": "https://restcountries.eu/data/mwi.svg", + "currency": "Malawian kwacha" + }, + { + "name": "Malaysia", + "capital": "Kuala Lumpur", + "languages": [ + "Malaysian" + ], + "population": 31405416, + "flag": "https://restcountries.eu/data/mys.svg", + "currency": "Malaysian ringgit" + }, + { + "name": "Maldives", + "capital": "Malé", + "languages": [ + "Divehi" + ], + "population": 344023, + "flag": "https://restcountries.eu/data/mdv.svg", + "currency": "Maldivian rufiyaa" + }, + { + "name": "Mali", + "capital": "Bamako", + "languages": [ + "French" + ], + "population": 18135000, + "flag": "https://restcountries.eu/data/mli.svg", + "currency": "West African CFA franc" + }, + { + "name": "Malta", + "capital": "Valletta", + "languages": [ + "Maltese", + "English" + ], + "population": 425384, + "flag": "https://restcountries.eu/data/mlt.svg", + "currency": "Euro" + }, + { + "name": "Marshall Islands", + "capital": "Majuro", + "languages": [ + "English", + "Marshallese" + ], + "population": 54880, + "flag": "https://restcountries.eu/data/mhl.svg", + "currency": "United States dollar" + }, + { + "name": "Martinique", + "capital": "Fort-de-France", + "languages": [ + "French" + ], + "population": 378243, + "flag": "https://restcountries.eu/data/mtq.svg", + "currency": "Euro" + }, + { + "name": "Mauritania", + "capital": "Nouakchott", + "languages": [ + "Arabic" + ], + "population": 3718678, + "flag": "https://restcountries.eu/data/mrt.svg", + "currency": "Mauritanian ouguiya" + }, + { + "name": "Mauritius", + "capital": "Port Louis", + "languages": [ + "English" + ], + "population": 1262879, + "flag": "https://restcountries.eu/data/mus.svg", + "currency": "Mauritian rupee" + }, + { + "name": "Mayotte", + "capital": "Mamoudzou", + "languages": [ + "French" + ], + "population": 226915, + "flag": "https://restcountries.eu/data/myt.svg", + "currency": "Euro" + }, + { + "name": "Mexico", + "capital": "Mexico City", + "languages": [ + "Spanish" + ], + "population": 122273473, + "flag": "https://restcountries.eu/data/mex.svg", + "currency": "Mexican peso" + }, + { + "name": "Micronesia (Federated States of)", + "capital": "Palikir", + "languages": [ + "English" + ], + "population": 102800, + "flag": "https://restcountries.eu/data/fsm.svg", + "currency": "[D]" + }, + { + "name": "Moldova (Republic of)", + "capital": "Chișinău", + "languages": [ + "Romanian" + ], + "population": 3553100, + "flag": "https://restcountries.eu/data/mda.svg", + "currency": "Moldovan leu" + }, + { + "name": "Monaco", + "capital": "Monaco", + "languages": [ + "French" + ], + "population": 38400, + "flag": "https://restcountries.eu/data/mco.svg", + "currency": "Euro" + }, + { + "name": "Mongolia", + "capital": "Ulan Bator", + "languages": [ + "Mongolian" + ], + "population": 3093100, + "flag": "https://restcountries.eu/data/mng.svg", + "currency": "Mongolian tögrög" + }, + { + "name": "Montenegro", + "capital": "Podgorica", + "languages": [ + "Serbian", + "Bosnian", + "Albanian", + "Croatian" + ], + "population": 621810, + "flag": "https://restcountries.eu/data/mne.svg", + "currency": "Euro" + }, + { + "name": "Montserrat", + "capital": "Plymouth", + "languages": [ + "English" + ], + "population": 4922, + "flag": "https://restcountries.eu/data/msr.svg", + "currency": "East Caribbean dollar" + }, + { + "name": "Morocco", + "capital": "Rabat", + "languages": [ + "Arabic" + ], + "population": 33337529, + "flag": "https://restcountries.eu/data/mar.svg", + "currency": "Moroccan dirham" + }, + { + "name": "Mozambique", + "capital": "Maputo", + "languages": [ + "Portuguese" + ], + "population": 26423700, + "flag": "https://restcountries.eu/data/moz.svg", + "currency": "Mozambican metical" + }, + { + "name": "Myanmar", + "capital": "Naypyidaw", + "languages": [ + "Burmese" + ], + "population": 51419420, + "flag": "https://restcountries.eu/data/mmr.svg", + "currency": "Burmese kyat" + }, + { + "name": "Namibia", + "capital": "Windhoek", + "languages": [ + "English", + "Afrikaans" + ], + "population": 2324388, + "flag": "https://restcountries.eu/data/nam.svg", + "currency": "Namibian dollar" + }, + { + "name": "Nauru", + "capital": "Yaren", + "languages": [ + "English", + "Nauruan" + ], + "population": 10084, + "flag": "https://restcountries.eu/data/nru.svg", + "currency": "Australian dollar" + }, + { + "name": "Nepal", + "capital": "Kathmandu", + "languages": [ + "Nepali" + ], + "population": 28431500, + "flag": "https://restcountries.eu/data/npl.svg", + "currency": "Nepalese rupee" + }, + { + "name": "Netherlands", + "capital": "Amsterdam", + "languages": [ + "Dutch" + ], + "population": 17019800, + "flag": "https://restcountries.eu/data/nld.svg", + "currency": "Euro" + }, + { + "name": "New Caledonia", + "capital": "Nouméa", + "languages": [ + "French" + ], + "population": 268767, + "flag": "https://restcountries.eu/data/ncl.svg", + "currency": "CFP franc" + }, + { + "name": "New Zealand", + "capital": "Wellington", + "languages": [ + "English", + "Māori" + ], + "population": 4697854, + "flag": "https://restcountries.eu/data/nzl.svg", + "currency": "New Zealand dollar" + }, + { + "name": "Nicaragua", + "capital": "Managua", + "languages": [ + "Spanish" + ], + "population": 6262703, + "flag": "https://restcountries.eu/data/nic.svg", + "currency": "Nicaraguan córdoba" + }, + { + "name": "Niger", + "capital": "Niamey", + "languages": [ + "French" + ], + "population": 20715000, + "flag": "https://restcountries.eu/data/ner.svg", + "currency": "West African CFA franc" + }, + { + "name": "Nigeria", + "capital": "Abuja", + "languages": [ + "English" + ], + "population": 186988000, + "flag": "https://restcountries.eu/data/nga.svg", + "currency": "Nigerian naira" + }, + { + "name": "Niue", + "capital": "Alofi", + "languages": [ + "English" + ], + "population": 1470, + "flag": "https://restcountries.eu/data/niu.svg", + "currency": "New Zealand dollar" + }, + { + "name": "Norfolk Island", + "capital": "Kingston", + "languages": [ + "English" + ], + "population": 2302, + "flag": "https://restcountries.eu/data/nfk.svg", + "currency": "Australian dollar" + }, + { + "name": "Korea (Democratic People's Republic of)", + "capital": "Pyongyang", + "languages": [ + "Korean" + ], + "population": 25281000, + "flag": "https://restcountries.eu/data/prk.svg", + "currency": "North Korean won" + }, + { + "name": "Northern Mariana Islands", + "capital": "Saipan", + "languages": [ + "English", + "Chamorro" + ], + "population": 56940, + "flag": "https://restcountries.eu/data/mnp.svg", + "currency": "United States dollar" + }, + { + "name": "Norway", + "capital": "Oslo", + "languages": [ + "Norwegian", + "Norwegian Bokmål", + "Norwegian Nynorsk" + ], + "population": 5223256, + "flag": "https://restcountries.eu/data/nor.svg", + "currency": "Norwegian krone" + }, + { + "name": "Oman", + "capital": "Muscat", + "languages": [ + "Arabic" + ], + "population": 4420133, + "flag": "https://restcountries.eu/data/omn.svg", + "currency": "Omani rial" + }, + { + "name": "Pakistan", + "capital": "Islamabad", + "languages": [ + "English", + "Urdu" + ], + "population": 194125062, + "flag": "https://restcountries.eu/data/pak.svg", + "currency": "Pakistani rupee" + }, + { + "name": "Palau", + "capital": "Ngerulmud", + "languages": [ + "English" + ], + "population": 17950, + "flag": "https://restcountries.eu/data/plw.svg", + "currency": "[E]" + }, + { + "name": "Palestine, State of", + "capital": "Ramallah", + "languages": [ + "Arabic" + ], + "population": 4682467, + "flag": "https://restcountries.eu/data/pse.svg", + "currency": "Israeli new sheqel" + }, + { + "name": "Panama", + "capital": "Panama City", + "languages": [ + "Spanish" + ], + "population": 3814672, + "flag": "https://restcountries.eu/data/pan.svg", + "currency": "Panamanian balboa" + }, + { + "name": "Papua New Guinea", + "capital": "Port Moresby", + "languages": [ + "English" + ], + "population": 8083700, + "flag": "https://restcountries.eu/data/png.svg", + "currency": "Papua New Guinean kina" + }, + { + "name": "Paraguay", + "capital": "Asunción", + "languages": [ + "Spanish", + "Guaraní" + ], + "population": 6854536, + "flag": "https://restcountries.eu/data/pry.svg", + "currency": "Paraguayan guaraní" + }, + { + "name": "Peru", + "capital": "Lima", + "languages": [ + "Spanish" + ], + "population": 31488700, + "flag": "https://restcountries.eu/data/per.svg", + "currency": "Peruvian sol" + }, + { + "name": "Philippines", + "capital": "Manila", + "languages": [ + "English" + ], + "population": 103279800, + "flag": "https://restcountries.eu/data/phl.svg", + "currency": "Philippine peso" + }, + { + "name": "Pitcairn", + "capital": "Adamstown", + "languages": [ + "English" + ], + "population": 56, + "flag": "https://restcountries.eu/data/pcn.svg", + "currency": "New Zealand dollar" + }, + { + "name": "Poland", + "capital": "Warsaw", + "languages": [ + "Polish" + ], + "population": 38437239, + "flag": "https://restcountries.eu/data/pol.svg", + "currency": "Polish złoty" + }, + { + "name": "Portugal", + "capital": "Lisbon", + "languages": [ + "Portuguese" + ], + "population": 10374822, + "flag": "https://restcountries.eu/data/prt.svg", + "currency": "Euro" + }, + { + "name": "Puerto Rico", + "capital": "San Juan", + "languages": [ + "Spanish", + "English" + ], + "population": 3474182, + "flag": "https://restcountries.eu/data/pri.svg", + "currency": "United States dollar" + }, + { + "name": "Qatar", + "capital": "Doha", + "languages": [ + "Arabic" + ], + "population": 2587564, + "flag": "https://restcountries.eu/data/qat.svg", + "currency": "Qatari riyal" + }, + { + "name": "Republic of Kosovo", + "capital": "Pristina", + "languages": [ + "Albanian", + "Serbian" + ], + "population": 1733842, + "flag": "https://restcountries.eu/data/kos.svg", + "currency": "Euro" + }, + { + "name": "Réunion", + "capital": "Saint-Denis", + "languages": [ + "French" + ], + "population": 840974, + "flag": "https://restcountries.eu/data/reu.svg", + "currency": "Euro" + }, + { + "name": "Romania", + "capital": "Bucharest", + "languages": [ + "Romanian" + ], + "population": 19861408, + "flag": "https://restcountries.eu/data/rou.svg", + "currency": "Romanian leu" + }, + { + "name": "Russian Federation", + "capital": "Moscow", + "languages": [ + "Russian" + ], + "population": 146599183, + "flag": "https://restcountries.eu/data/rus.svg", + "currency": "Russian ruble" + }, + { + "name": "Rwanda", + "capital": "Kigali", + "languages": [ + "Kinyarwanda", + "English", + "French" + ], + "population": 11553188, + "flag": "https://restcountries.eu/data/rwa.svg", + "currency": "Rwandan franc" + }, + { + "name": "Saint Barthélemy", + "capital": "Gustavia", + "languages": [ + "French" + ], + "population": 9417, + "flag": "https://restcountries.eu/data/blm.svg", + "currency": "Euro" + }, + { + "name": "Saint Helena, Ascension and Tristan da Cunha", + "capital": "Jamestown", + "languages": [ + "English" + ], + "population": 4255, + "flag": "https://restcountries.eu/data/shn.svg", + "currency": "Saint Helena pound" + }, + { + "name": "Saint Kitts and Nevis", + "capital": "Basseterre", + "languages": [ + "English" + ], + "population": 46204, + "flag": "https://restcountries.eu/data/kna.svg", + "currency": "East Caribbean dollar" + }, + { + "name": "Saint Lucia", + "capital": "Castries", + "languages": [ + "English" + ], + "population": 186000, + "flag": "https://restcountries.eu/data/lca.svg", + "currency": "East Caribbean dollar" + }, + { + "name": "Saint Martin (French part)", + "capital": "Marigot", + "languages": [ + "English", + "French", + "Dutch" + ], + "population": 36979, + "flag": "https://restcountries.eu/data/maf.svg", + "currency": "Euro" + }, + { + "name": "Saint Pierre and Miquelon", + "capital": "Saint-Pierre", + "languages": [ + "French" + ], + "population": 6069, + "flag": "https://restcountries.eu/data/spm.svg", + "currency": "Euro" + }, + { + "name": "Saint Vincent and the Grenadines", + "capital": "Kingstown", + "languages": [ + "English" + ], + "population": 109991, + "flag": "https://restcountries.eu/data/vct.svg", + "currency": "East Caribbean dollar" + }, + { + "name": "Samoa", + "capital": "Apia", + "languages": [ + "Samoan", + "English" + ], + "population": 194899, + "flag": "https://restcountries.eu/data/wsm.svg", + "currency": "Samoan tālā" + }, + { + "name": "San Marino", + "capital": "City of San Marino", + "languages": [ + "Italian" + ], + "population": 33005, + "flag": "https://restcountries.eu/data/smr.svg", + "currency": "Euro" + }, + { + "name": "Sao Tome and Principe", + "capital": "São Tomé", + "languages": [ + "Portuguese" + ], + "population": 187356, + "flag": "https://restcountries.eu/data/stp.svg", + "currency": "São Tomé and Príncipe dobra" + }, + { + "name": "Saudi Arabia", + "capital": "Riyadh", + "languages": [ + "Arabic" + ], + "population": 32248200, + "flag": "https://restcountries.eu/data/sau.svg", + "currency": "Saudi riyal" + }, + { + "name": "Senegal", + "capital": "Dakar", + "languages": [ + "French" + ], + "population": 14799859, + "flag": "https://restcountries.eu/data/sen.svg", + "currency": "West African CFA franc" + }, + { + "name": "Serbia", + "capital": "Belgrade", + "languages": [ + "Serbian" + ], + "population": 7076372, + "flag": "https://restcountries.eu/data/srb.svg", + "currency": "Serbian dinar" + }, + { + "name": "Seychelles", + "capital": "Victoria", + "languages": [ + "French", + "English" + ], + "population": 91400, + "flag": "https://restcountries.eu/data/syc.svg", + "currency": "Seychellois rupee" + }, + { + "name": "Sierra Leone", + "capital": "Freetown", + "languages": [ + "English" + ], + "population": 7075641, + "flag": "https://restcountries.eu/data/sle.svg", + "currency": "Sierra Leonean leone" + }, + { + "name": "Singapore", + "capital": "Singapore", + "languages": [ + "English", + "Malay", + "Tamil", + "Chinese" + ], + "population": 5535000, + "flag": "https://restcountries.eu/data/sgp.svg", + "currency": "Brunei dollar" + }, + { + "name": "Sint Maarten (Dutch part)", + "capital": "Philipsburg", + "languages": [ + "Dutch", + "English" + ], + "population": 38247, + "flag": "https://restcountries.eu/data/sxm.svg", + "currency": "Netherlands Antillean guilder" + }, + { + "name": "Slovakia", + "capital": "Bratislava", + "languages": [ + "Slovak" + ], + "population": 5426252, + "flag": "https://restcountries.eu/data/svk.svg", + "currency": "Euro" + }, + { + "name": "Slovenia", + "capital": "Ljubljana", + "languages": [ + "Slovene" + ], + "population": 2064188, + "flag": "https://restcountries.eu/data/svn.svg", + "currency": "Euro" + }, + { + "name": "Solomon Islands", + "capital": "Honiara", + "languages": [ + "English" + ], + "population": 642000, + "flag": "https://restcountries.eu/data/slb.svg", + "currency": "Solomon Islands dollar" + }, + { + "name": "Somalia", + "capital": "Mogadishu", + "languages": [ + "Somali", + "Arabic" + ], + "population": 11079000, + "flag": "https://restcountries.eu/data/som.svg", + "currency": "Somali shilling" + }, + { + "name": "South Africa", + "capital": "Pretoria", + "languages": [ + "Afrikaans", + "English", + "Southern Ndebele", + "Southern Sotho", + "Swati", + "Tswana", + "Tsonga", + "Venda", + "Xhosa", + "Zulu" + ], + "population": 55653654, + "flag": "https://restcountries.eu/data/zaf.svg", + "currency": "South African rand" + }, + { + "name": "South Georgia and the South Sandwich Islands", + "capital": "King Edward Point", + "languages": [ + "English" + ], + "population": 30, + "flag": "https://restcountries.eu/data/sgs.svg", + "currency": "British pound" + }, + { + "name": "Korea (Republic of)", + "capital": "Seoul", + "languages": [ + "Korean" + ], + "population": 50801405, + "flag": "https://restcountries.eu/data/kor.svg", + "currency": "South Korean won" + }, + { + "name": "South Sudan", + "capital": "Juba", + "languages": [ + "English" + ], + "population": 12131000, + "flag": "https://restcountries.eu/data/ssd.svg", + "currency": "South Sudanese pound" + }, + { + "name": "Spain", + "capital": "Madrid", + "languages": [ + "Spanish" + ], + "population": 46438422, + "flag": "https://restcountries.eu/data/esp.svg", + "currency": "Euro" + }, + { + "name": "Sri Lanka", + "capital": "Colombo", + "languages": [ + "Sinhalese", + "Tamil" + ], + "population": 20966000, + "flag": "https://restcountries.eu/data/lka.svg", + "currency": "Sri Lankan rupee" + }, + { + "name": "Sudan", + "capital": "Khartoum", + "languages": [ + "Arabic", + "English" + ], + "population": 39598700, + "flag": "https://restcountries.eu/data/sdn.svg", + "currency": "Sudanese pound" + }, + { + "name": "Suriname", + "capital": "Paramaribo", + "languages": [ + "Dutch" + ], + "population": 541638, + "flag": "https://restcountries.eu/data/sur.svg", + "currency": "Surinamese dollar" + }, + { + "name": "Svalbard and Jan Mayen", + "capital": "Longyearbyen", + "languages": [ + "Norwegian" + ], + "population": 2562, + "flag": "https://restcountries.eu/data/sjm.svg", + "currency": "Norwegian krone" + }, + { + "name": "Swaziland", + "capital": "Lobamba", + "languages": [ + "English", + "Swati" + ], + "population": 1132657, + "flag": "https://restcountries.eu/data/swz.svg", + "currency": "Swazi lilangeni" + }, + { + "name": "Sweden", + "capital": "Stockholm", + "languages": [ + "Swedish" + ], + "population": 9894888, + "flag": "https://restcountries.eu/data/swe.svg", + "currency": "Swedish krona" + }, + { + "name": "Switzerland", + "capital": "Bern", + "languages": [ + "German", + "French", + "Italian" + ], + "population": 8341600, + "flag": "https://restcountries.eu/data/che.svg", + "currency": "Swiss franc" + }, + { + "name": "Syrian Arab Republic", + "capital": "Damascus", + "languages": [ + "Arabic" + ], + "population": 18564000, + "flag": "https://restcountries.eu/data/syr.svg", + "currency": "Syrian pound" + }, + { + "name": "Taiwan", + "capital": "Taipei", + "languages": [ + "Chinese" + ], + "population": 23503349, + "flag": "https://restcountries.eu/data/twn.svg", + "currency": "New Taiwan dollar" + }, + { + "name": "Tajikistan", + "capital": "Dushanbe", + "languages": [ + "Tajik", + "Russian" + ], + "population": 8593600, + "flag": "https://restcountries.eu/data/tjk.svg", + "currency": "Tajikistani somoni" + }, + { + "name": "Tanzania, United Republic of", + "capital": "Dodoma", + "languages": [ + "Swahili", + "English" + ], + "population": 55155000, + "flag": "https://restcountries.eu/data/tza.svg", + "currency": "Tanzanian shilling" + }, + { + "name": "Thailand", + "capital": "Bangkok", + "languages": [ + "Thai" + ], + "population": 65327652, + "flag": "https://restcountries.eu/data/tha.svg", + "currency": "Thai baht" + }, + { + "name": "Timor-Leste", + "capital": "Dili", + "languages": [ + "Portuguese" + ], + "population": 1167242, + "flag": "https://restcountries.eu/data/tls.svg", + "currency": "United States dollar" + }, + { + "name": "Togo", + "capital": "Lomé", + "languages": [ + "French" + ], + "population": 7143000, + "flag": "https://restcountries.eu/data/tgo.svg", + "currency": "West African CFA franc" + }, + { + "name": "Tokelau", + "capital": "Fakaofo", + "languages": [ + "English" + ], + "population": 1411, + "flag": "https://restcountries.eu/data/tkl.svg", + "currency": "New Zealand dollar" + }, + { + "name": "Tonga", + "capital": "Nuku'alofa", + "languages": [ + "English", + "Tonga (Tonga Islands)" + ], + "population": 103252, + "flag": "https://restcountries.eu/data/ton.svg", + "currency": "Tongan paʻanga" + }, + { + "name": "Trinidad and Tobago", + "capital": "Port of Spain", + "languages": [ + "English" + ], + "population": 1349667, + "flag": "https://restcountries.eu/data/tto.svg", + "currency": "Trinidad and Tobago dollar" + }, + { + "name": "Tunisia", + "capital": "Tunis", + "languages": [ + "Arabic" + ], + "population": 11154400, + "flag": "https://restcountries.eu/data/tun.svg", + "currency": "Tunisian dinar" + }, + { + "name": "Turkey", + "capital": "Ankara", + "languages": [ + "Turkish" + ], + "population": 78741053, + "flag": "https://restcountries.eu/data/tur.svg", + "currency": "Turkish lira" + }, + { + "name": "Turkmenistan", + "capital": "Ashgabat", + "languages": [ + "Turkmen", + "Russian" + ], + "population": 4751120, + "flag": "https://restcountries.eu/data/tkm.svg", + "currency": "Turkmenistan manat" + }, + { + "name": "Turks and Caicos Islands", + "capital": "Cockburn Town", + "languages": [ + "English" + ], + "population": 31458, + "flag": "https://restcountries.eu/data/tca.svg", + "currency": "United States dollar" + }, + { + "name": "Tuvalu", + "capital": "Funafuti", + "languages": [ + "English" + ], + "population": 10640, + "flag": "https://restcountries.eu/data/tuv.svg", + "currency": "Australian dollar" + }, + { + "name": "Uganda", + "capital": "Kampala", + "languages": [ + "English", + "Swahili" + ], + "population": 33860700, + "flag": "https://restcountries.eu/data/uga.svg", + "currency": "Ugandan shilling" + }, + { + "name": "Ukraine", + "capital": "Kiev", + "languages": [ + "Ukrainian" + ], + "population": 42692393, + "flag": "https://restcountries.eu/data/ukr.svg", + "currency": "Ukrainian hryvnia" + }, + { + "name": "United Arab Emirates", + "capital": "Abu Dhabi", + "languages": [ + "Arabic" + ], + "population": 9856000, + "flag": "https://restcountries.eu/data/are.svg", + "currency": "United Arab Emirates dirham" + }, + { + "name": "United Kingdom of Great Britain and Northern Ireland", + "capital": "London", + "languages": [ + "English" + ], + "population": 65110000, + "flag": "https://restcountries.eu/data/gbr.svg", + "currency": "British pound" + }, + { + "name": "United States of America", + "capital": "Washington, D.C.", + "languages": [ + "English" + ], + "population": 323947000, + "flag": "https://restcountries.eu/data/usa.svg", + "currency": "United States dollar" + }, + { + "name": "Uruguay", + "capital": "Montevideo", + "languages": [ + "Spanish" + ], + "population": 3480222, + "flag": "https://restcountries.eu/data/ury.svg", + "currency": "Uruguayan peso" + }, + { + "name": "Uzbekistan", + "capital": "Tashkent", + "languages": [ + "Uzbek", + "Russian" + ], + "population": 31576400, + "flag": "https://restcountries.eu/data/uzb.svg", + "currency": "Uzbekistani so'm" + }, + { + "name": "Vanuatu", + "capital": "Port Vila", + "languages": [ + "Bislama", + "English", + "French" + ], + "population": 277500, + "flag": "https://restcountries.eu/data/vut.svg", + "currency": "Vanuatu vatu" + }, + { + "name": "Venezuela (Bolivarian Republic of)", + "capital": "Caracas", + "languages": [ + "Spanish" + ], + "population": 31028700, + "flag": "https://restcountries.eu/data/ven.svg", + "currency": "Venezuelan bolívar" + }, + { + "name": "Viet Nam", + "capital": "Hanoi", + "languages": [ + "Vietnamese" + ], + "population": 92700000, + "flag": "https://restcountries.eu/data/vnm.svg", + "currency": "Vietnamese đồng" + }, + { + "name": "Wallis and Futuna", + "capital": "Mata-Utu", + "languages": [ + "French" + ], + "population": 11750, + "flag": "https://restcountries.eu/data/wlf.svg", + "currency": "CFP franc" + }, + { + "name": "Western Sahara", + "capital": "El Aaiún", + "languages": [ + "Spanish" + ], + "population": 510713, + "flag": "https://restcountries.eu/data/esh.svg", + "currency": "Moroccan dirham" + }, + { + "name": "Yemen", + "capital": "Sana'a", + "languages": [ + "Arabic" + ], + "population": 27478000, + "flag": "https://restcountries.eu/data/yem.svg", + "currency": "Yemeni rial" + }, + { + "name": "Zambia", + "capital": "Lusaka", + "languages": [ + "English" + ], + "population": 15933883, + "flag": "https://restcountries.eu/data/zmb.svg", + "currency": "Zambian kwacha" + }, + { + "name": "Zimbabwe", + "capital": "Harare", + "languages": [ + "English", + "Shona", + "Northern Ndebele" + ], + "population": 14240168, + "flag": "https://restcountries.eu/data/zwe.svg", + "currency": "Botswana pula" + } +] \ No newline at end of file