{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loops and Lists — Lesson 2\n",
    "## Practical exercises\n",
    "\n",
    "**Topics:** `while`, `for + range()`, `break / continue`, lists, slicing, list methods, iterating collections\n",
    "\n",
    "Replace `pass` with your code and run the cell (Shift + Enter)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 1. Numbers from 1 to N\n",
    "\n",
    "Using a `while` loop, ask the user for an integer N and print all numbers from 1 to N on one line, separated by spaces."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 2. Sum from 1 to N\n",
    "\n",
    "Use `for` and `range()` to compute the sum of all numbers from 1 to N inclusive."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 3. Maximum in a list\n",
    "\n",
    "Given a list of numbers, find the maximum value without using the built-in `max()` function.\n",
    "\n",
    "```python\n",
    "numbers = [42, 17, 89, 23, 56, 91, 8, 64]\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "numbers = [42, 17, 89, 23, 56, 91, 8, 64]\n",
    "\n",
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 4. Counting occurrences\n",
    "\n",
    "Given a list of grades, count how many times the grade 5 appears.\n",
    "\n",
    "```python\n",
    "grades = [3, 5, 4, 5, 2, 5, 4, 3, 5, 4]\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "grades = [3, 5, 4, 5, 2, 5, 4, 3, 5, 4]\n",
    "\n",
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 5. First negative number\n",
    "\n",
    "Given a list, find the first negative number and stop the search using `break`.\n",
    "\n",
    "```python\n",
    "values = [10, 25, 3, -7, 18, -2, 9]\n",
    "```\n",
    "\n",
    "Expected output: `-7`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "values = [10, 25, 3, -7, 18, -2, 9]\n",
    "\n",
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 6. Skip negative values\n",
    "\n",
    "Given a list, print only the positive numbers, skipping the negative ones with `continue`.\n",
    "\n",
    "```python\n",
    "values = [4, -1, 7, -3, 12, -5, 9]\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "values = [4, -1, 7, -3, 12, -5, 9]\n",
    "\n",
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 7. Reverse a list\n",
    "\n",
    "Given a list, produce a new list with elements in reverse order without using `reverse()` or the slice `[::-1]`.\n",
    "\n",
    "```python\n",
    "items = [\"a\", \"b\", \"c\", \"d\", \"e\"]\n",
    "```\n",
    "\n",
    "Expected result: `['e', 'd', 'c', 'b', 'a']`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "items = [\"a\", \"b\", \"c\", \"d\", \"e\"]\n",
    "\n",
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 8. Multiplication table\n",
    "\n",
    "Use nested loops to print the 5 × 5 multiplication table in this format:\n",
    "```\n",
    "1 × 1 = 1\n",
    "1 × 2 = 2\n",
    "...\n",
    "5 × 5 = 25\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 9. Remove duplicates\n",
    "\n",
    "Given a list with duplicate elements, create a new list without duplicates while preserving the order of first occurrences.\n",
    "\n",
    "```python\n",
    "items = [1, 2, 2, 3, 4, 3, 5, 1, 6, 4]\n",
    "```\n",
    "\n",
    "Expected result: `[1, 2, 3, 4, 5, 6]`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "items = [1, 2, 2, 3, 4, 3, 5, 1, 6, 4]\n",
    "\n",
    "# Your code here\n",
    "pass"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Exercise 10. Count vowels\n",
    "\n",
    "Ask for a string. Count the number of vowels (a, e, i, o, u). Case-insensitive."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Your code here\n",
    "pass"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
