{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "## **PYTHON CONDITIONALS**"
      ],
      "metadata": {
        "id": "tO8u9jeumJw9"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "**What is an if statement?**\n",
        "\n",
        "If statements test for a condition, and then responds to that condition.\n",
        "If the condition is true, then whatever action is listed next gets carried out.\n",
        "\n",
        "Example - if the condition is True, the code inside will run. If it isn't, the code is skipped over.:\n",
        "\n",
        "if condition:\n",
        "\n",
        "      code to execute if condition is true\n",
        "      code to execute if condition is true\n",
        "\n",
        "code for the rest of your program"
      ],
      "metadata": {
        "id": "rkP4JNw6mht_"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Test #1**\n",
        "\n",
        "Run the following code segments. Enter a word the first time and don't enter anything the next time, just hit enter."
      ],
      "metadata": {
        "id": "7TMSr8aSnJ_4"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "message = input(\"Enter something: \")\n",
        "if message == '':\n",
        "    print(\"You didn't enter anything!\")\n",
        "else:\n",
        "    print(\"You entered:\", message)"
      ],
      "metadata": {
        "id": "Ka4XoQZ2nQLr"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Using Bard**\n",
        "\n",
        "Copy the code into Bard and have it explain the line below:\n",
        "\n",
        "**if message == '':**\n"
      ],
      "metadata": {
        "id": "D8FaKgnYoRli"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Enter your answer here:\n",
        "\n",
        "\n",
        "\n",
        "\n"
      ],
      "metadata": {
        "id": "gqEWwC55pBbI"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Test #2**\n",
        "\n",
        "Does the code segment below produce the same result as the one above?\n",
        "\n",
        "What does the word *not* do?"
      ],
      "metadata": {
        "id": "MbBf4BzHpM-i"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "message = input(\"Enter something: \")\n",
        "\n",
        "if not message:\n",
        "    print(\"You didn't enter anything!\")\n",
        "else:\n",
        "    print(\"You entered:\", message)"
      ],
      "metadata": {
        "id": "3hrjqj55pbR7"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Test #3**\n",
        "\n",
        "Are there other ways to write this code segment? Ask Bard and explain how each segment is different. Do they produce the correct results?"
      ],
      "metadata": {
        "id": "nlbXa0Uvp8CE"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Segment 1\n"
      ],
      "metadata": {
        "id": "Mph5zkkhqO3W"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# Segment 2\n"
      ],
      "metadata": {
        "id": "we5ya3FRqRa3"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Check for Understanding** - ***created by Bard***\n",
        "\n",
        "Question 1: What is the purpose of the input() function in the code?\n",
        "\n",
        "    To ask the user to enter something\n",
        "    To check if the user entered anything\n",
        "    To store the user's input in a variable\n",
        "    All of the above\n",
        "\n",
        "Question 2: What is the output of the code if the user enters \"Hello!\"?\n",
        "\n",
        "    You didn't enter anything!\n",
        "    Hello!\n",
        "    You entered: Hello!\n",
        "    None of the above\n",
        "\n",
        "Question 3: How else could the code be written?\n",
        "\n",
        "    The code could be written using the not operator.\n",
        "    The code could be written using the len() function.\n",
        "    The code could be written using the strip() method.\n",
        "    All of the above\n"
      ],
      "metadata": {
        "id": "GHRCdDrBtva9"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Using Bard for a Conversation**\n",
        "\n",
        "Using Bard create a conversation between a computer science teacher and a student that is trying to understand conditionals.\n",
        "1. What code example does Bard give you? Paste it below and test it.\n",
        "2. In your own words explain the code.\n",
        "\n",
        "Tell Bard you still do not understand.\n",
        "1. What new insights did you gain by having the AI explain conditionals in greater depth?"
      ],
      "metadata": {
        "id": "HyDe06mS3GFq"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Paste code from your conversation here\n"
      ],
      "metadata": {
        "id": "UPDapD7g5aNf"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Code Practice #1**\n",
        "\n",
        "Step #1 - Uplugged\n",
        "\n",
        "Using paper/pen write the psedocode to solve the problem below\n",
        "\n",
        "Step #2 - Using Bard\n",
        "\n",
        "Solve the problem below. Ask Bard to show you different ways to solve this problem. Ask Bard to show you its pseudocode.\n",
        "\n",
        "**Directions:**\n",
        "Test if a password entered is correct. The secret phrase is “Barack Obama” (without the quotes).\n",
        "\n",
        "*Sample Run 1*\n",
        "\n",
        "    Enter the password: Barack Obama\n",
        "\n",
        "*Sample Output 1*\n",
        "\n",
        "    Correct!\n",
        "\n",
        "*Sample Run 2*\n",
        "\n",
        "    Enter the password: Superman\n",
        "\n",
        "*Sample Output 2*\n",
        "\n",
        "    Not Correct"
      ],
      "metadata": {
        "id": "UsM3zOgKudwx"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Summary Questions - ***created by Bard***\n",
        "\n",
        "    What happens if the user enters an empty string for the password?\n",
        "    What happens if the user enters a password that is not case-sensitive?\n",
        "    How can you improve the code to make it more robust?\n",
        "    What other ways could you check if the password is correct?\n",
        "    How could you use the code to create a login system?\n",
        "    How could you use the code to create a password strength checker?\n",
        "    What are two things Bard taught you in this lesson?\n"
      ],
      "metadata": {
        "id": "JJiZv59JxTVX"
      }
    }
  ]
}