{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "intro",
   "metadata": {},
   "source": [
    "# Control Flow Practice Questions (Instructor Solutions)\n",
    "\n",
    "This notebook contains **10 short and simple Python control-flow practice problems**.\n",
    "\n",
    "Each question includes:\n",
    "- Function definition with correct return statements\n",
    "- Clear explanation of what the function should return"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "student_info",
   "metadata": {},
   "outputs": [],
   "source": [
    "name = 'student name'\n",
    "roll_number = 'student roll number'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q1text",
   "metadata": {},
   "source": [
    "### 1. Check if a number is positive, negative, or zero\n",
    "**Return:** A string such as `'Positive'`, `'Negative'`, or `'Zero'`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q1code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def check_number(n: int) -> str:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q2text",
   "metadata": {},
   "source": [
    "### 2. Return a list of numbers from 1 to n (where n can be anything).\n",
    "Example if n = 5 then\n",
    "**Return:** `[1, 2, 3, 4, 5]`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q2code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def numbers_1_to_n(n) -> list[int]:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q3text",
   "metadata": {},
   "source": [
    "### 3. Return only even numbers from 1 to n (where n can be anything).\n",
    "Example if n = 11 then\n",
    "**Return:** `[2, 4, 6, 8, 10]`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q3code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def even_numbers_1_to_n(n) -> list[int]:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q4text",
   "metadata": {},
   "source": [
    "### 4. Return the square of a given number\n",
    "**Example:** For input `4`, return `16`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q4code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def square_number(n: int) -> int:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q5text",
   "metadata": {},
   "source": [
    "### 5. Return `'Access Granted'` if the password is `'python'`, else `'Access Denied'`\n",
    "**Example:** Input `'java'` → `'Access Denied'`; Input `'python'` → `'Access Granted'`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q5code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def check_password(password: str) -> str:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q6text",
   "metadata": {},
   "source": [
    "### 6. Return the larger of two numbers  \n",
    "**Example:** Input `(4, 9)` → `9`  \n",
    "**Return:** The larger number."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q6code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def larger_number(a: int, b: int) -> int:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q7text",
   "metadata": {},
   "source": [
    "### 7. Return `'Even'` if a number is even, else `'Odd'`\n",
    "**Example:** Input `4` → `'Even'`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q7code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def even_or_odd(n: int) -> str:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q8text",
   "metadata": {},
   "source": [
    "### 8. Return the sum of numbers from 1 to `n`\n",
    "\n",
    "**Example:** Input `5` → `15`\n",
    "because 1+2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q8code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def sum_1_to_n(n: int) -> int:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q9text",
   "metadata": {},
   "source": [
    "### 9. Return a list of squares for numbers 1 to n\n",
    "if n is 5\n",
    "**Return:** `[1, 4, 9, 16, 25]`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q9code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def squares_1_to_n(n) -> list[int]:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "q10text",
   "metadata": {},
   "source": [
    "### 10. Count how many times a letter appears in a word  \n",
    "**Example:** Input `('banana', 'a')`\n",
    "**Return:** `3`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "q10code",
   "metadata": {},
   "outputs": [],
   "source": [
    "def count_letter(word: str, letter: str) -> int:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "804b37c4-f3fa-4049-b4dd-50323b2c25ac",
   "metadata": {},
   "source": [
    "### 11. Return the average of three numbers  \n",
    "**Example:** Input `(4, 8, 10)` → `7.3333...`  \n",
    "**Return:** The arithmetic mean of the three numbers."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1240e378-3eca-43a6-a5d0-b326dbd7855b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.0"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def average_of_three(a: float, b: float, c: float) -> float:\n",
    "    pass"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.1+"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
