From 62590bd07a0ac3826c7a76f901c67bff467e1d4c Mon Sep 17 00:00:00 2001 From: Waghraj Patil <149173632+Waghraj1699@users.noreply.github.com> Date: Sun, 18 Aug 2024 13:31:18 +0530 Subject: [PATCH] Add files via upload --- Day 19/Assignment_10B.ipynb | 294 +++++++++++++++++++++++++ Day 19/Assignment_11.ipynb | 237 ++++++++++++++++++++ Day 19/Coding_Practice_11A.ipynb | 258 ++++++++++++++++++++++ Day 19/Coding_Practice_11B.ipynb | 366 +++++++++++++++++++++++++++++++ 4 files changed, 1155 insertions(+) create mode 100644 Day 19/Assignment_10B.ipynb create mode 100644 Day 19/Assignment_11.ipynb create mode 100644 Day 19/Coding_Practice_11A.ipynb create mode 100644 Day 19/Coding_Practice_11B.ipynb diff --git a/Day 19/Assignment_10B.ipynb b/Day 19/Assignment_10B.ipynb new file mode 100644 index 0000000..c532688 --- /dev/null +++ b/Day 19/Assignment_10B.ipynb @@ -0,0 +1,294 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Zb-9TXtxZNGn", + "outputId": "094c0428-4720-472d-88d8-d4c972cd50d6" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "5\n", + " 1 \n", + " 2 2 \n", + " 3 3 \n", + " 4 4 \n", + "5 5 \n", + " 4 4 \n", + " 3 3 \n", + " 2 2 \n", + " 1 \n" + ] + } + ], + "source": [ + "# Inverted Hollow Pyramid - 2\n", + "\n", + "n = int(input())\n", + "\n", + "for i in range(1 , n + 1):\n", + " if (i==1):\n", + " left_spaces = (\" \") * (2*(n - i))\n", + " row = left_spaces + (str(i) + \" \")\n", + " else:\n", + " left_spaces = (\" \") * (2*(n - i))\n", + " middle_spaces = (\" \") * (2*(i - 2))\n", + " row = left_spaces + (str(i) + \" \") + middle_spaces + (str(i) + \" \")\n", + " print(row)\n", + "\n", + "for i in range(1 , n):\n", + " if (i==(n - 1)):\n", + " left_spaces = (\" \") * (2*i)\n", + " row = left_spaces + (str(1) + \" \")\n", + " else:\n", + " left_spaces = (\" \") * (2*i)\n", + " middle_spaces = (\" \") * (2*(n - i) - 4)\n", + " row =left_spaces + (str(n - i) + \" \") + middle_spaces + (str(n - i) + \" \")\n", + "\n", + " print(row)" + ] + }, + { + "cell_type": "code", + "source": [ + "# Two Triangles - 3\n", + "\n", + "n = int(input())\n", + "\n", + "for i in range(1 , n + 1):\n", + " if (i==1):\n", + " middle_spaces = (\" \") * (4*(n - i))\n", + " row = (\"* \") + middle_spaces + (\"* \")\n", + " elif (i==n):\n", + " row = (\"* \") * (2*n)\n", + " else:\n", + " left_spaces = (\" \") * (2*(i - 2))\n", + " middle_spaces = (\" \") * (4*(n - i))\n", + " right_spaces = (\" \") * (2*(i - 2))\n", + " row = (\"* \") + left_spaces + (\"* \") + middle_spaces + (\"* \") + right_spaces + (\"* \")\n", + " print(row)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "yHp0U8xdayIt", + "outputId": "729c4d4c-fc3a-4a34-de1a-e910b8561695" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "5\n", + "* * \n", + "* * * * \n", + "* * * * \n", + "* * * * \n", + "* * * * * * * * * * \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Hollow Butterfly\n", + "\n", + "n = int(input())\n", + "\n", + "for i in range(1, n + 1):\n", + " if (i==1):\n", + " middle_spaces = (\" \") * (4*(n - i))\n", + " row = (\"* \") + middle_spaces + (\"* \")\n", + " else:\n", + " left_space = (\" \") * (2*(i - 2))\n", + " right_space = (\" \") * (2*(i - 2))\n", + " middle_spaces = (\" \") * (4*(n - i))\n", + " row = (\"* \") + left_space + (\"* \") + middle_spaces + (\"* \") + right_space + (\"* \")\n", + " print(row)\n", + "\n", + "for i in range(1 , n + 1):\n", + " if (i==n):\n", + " middle_spaces = (\" \") * (4*(i - 1))\n", + " row = (\"* \") + middle_spaces + (\"* \")\n", + " else:\n", + " left_space = (\" \") * (2*(n - i) - 2)\n", + " right_space = (\" \") * (2*(n - i) - 2)\n", + " middle_spaces = (\" \") * (4*(i - 1))\n", + " row = (\"* \") + left_space + (\"* \") + middle_spaces + (\"* \") + right_space + (\"* \")\n", + " print(row)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "lHYNGExPa8Qg", + "outputId": "14d28fc9-06f9-4d5c-8927-e0afca6dc0e0" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "5\n", + "* * \n", + "* * * * \n", + "* * * * \n", + "* * * * \n", + "* * * * \n", + "* * * * \n", + "* * * * \n", + "* * * * \n", + "* * * * \n", + "* * \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Perfect square in range\n", + "\n", + "a = int(input())\n", + "b = int(input())\n", + "count = 0\n", + "\n", + "for i in range(a , b + 1):\n", + " if int(i ** 0.5) ** 2 == i:\n", + " count = count + 1\n", + "\n", + "print(count)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "7vSAVmIrbKKe", + "outputId": "71dcc7e9-d9c8-4409-803b-c6b509cd75ad" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "9\n", + "100\n", + "8\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Solid and Hollow Diamond\n", + "\n", + "n = int(input())\n", + "\n", + "for i in range(1 , n + 1):\n", + " stars = \"* \" * (i)\n", + " spaces = \" \" * (n - i)\n", + " row = spaces + stars\n", + " print(row)\n", + "\n", + "for i in range(1 , n):\n", + " if (i==n-1):\n", + " spaces = \" \" * (i)\n", + " row = spaces + (\"* \")\n", + " else:\n", + " left_spaces = (\" \") * i\n", + " middle_spaces = (\" \") * (2*(n - i) - 3)\n", + " row = left_spaces + (\"*\") + middle_spaces + (\"*\")\n", + " print(row)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "z5ZMQJ5vb3Jc", + "outputId": "20bd0479-8045-4554-e365-193066778bf5" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "5\n", + " * \n", + " * * \n", + " * * * \n", + " * * * * \n", + "* * * * * \n", + " * *\n", + " * *\n", + " * *\n", + " * \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Solid right Angled - 2\n", + "\n", + "n = int(input())\n", + "\n", + "for i in range(1 , n + 1 ):\n", + " stars = (\"* \") * i\n", + " spaces = (\" \") * (2*(n-i))\n", + " row = spaces + stars\n", + " print(row)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "YkITcZeob_oI", + "outputId": "52ae9409-0f4a-4707-f785-721ab7f9e35a" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "5\n", + " * \n", + " * * \n", + " * * * \n", + " * * * * \n", + "* * * * * \n" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/Day 19/Assignment_11.ipynb b/Day 19/Assignment_11.ipynb new file mode 100644 index 0000000..8a331a0 --- /dev/null +++ b/Day 19/Assignment_11.ipynb @@ -0,0 +1,237 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Palindrom - 3" + ], + "metadata": { + "id": "HcnMLHI0SA5f" + } + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "no76cdmMGtcR", + "outputId": "e219598c-2b7d-4c1e-aecc-514c375b6a63" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "madam\n", + "Palindrome\n" + ] + } + ], + "source": [ + "word = input()\n", + "word = word.lower()\n", + "\n", + "reverse = \"\"\n", + "for i in word:\n", + " reverse = i + reverse\n", + "\n", + "if word == reverse:\n", + " print(\"Palindrome\")\n", + "else:\n", + " print(\"Not a Palindrome\")" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Palindrom - 4" + ], + "metadata": { + "id": "fO-MHJoRSI25" + } + }, + { + "cell_type": "code", + "source": [ + "string = input()\n", + "string = string.lower()\n", + "new_string = \"\"\n", + "reverse = \"\"\n", + "\n", + "for i in string:\n", + " if i==\" \" or i==\"'\":\n", + " new_string = new_string\n", + " else:\n", + " new_string = new_string + i\n", + "\n", + "for j in new_string:\n", + " reverse = j + reverse\n", + "\n", + "if new_string == reverse:\n", + " print(\"True\")\n", + "else:\n", + " print(\"False\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hapu32n0SLwB", + "outputId": "34826402-e023-48ef-856b-4d77347b2475" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "no lemon no melon\n", + "True\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Remove Vowels in sentences" + ], + "metadata": { + "id": "TmFqRRKNSRPP" + } + }, + { + "cell_type": "code", + "source": [ + "word = input()\n", + "result = \"\"\n", + "\n", + "for i in word:\n", + " condition1 = (i==\"a\") or (i==\"e\") or (i==\"i\") or (i==\"o\") or (i==\"u\")\n", + " condition2 = (i==\"A\") or (i==\"E\") or (i==\"I\") or (i==\"O\") or (i==\"U\")\n", + " if condition1 or condition2:\n", + " result = result\n", + " else:\n", + " result = result + i\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "TMd13W5cSVFQ", + "outputId": "5f2b01d1-4d79-4d76-eb54-1e341bcde518" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Hello world\n", + "Hll wrld\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "# First part or last part" + ], + "metadata": { + "id": "-4rBNuUsSWBJ" + } + }, + { + "cell_type": "code", + "source": [ + "s1 = input()\n", + "s2 = input()\n", + "\n", + "if s1.startswith(s2) or s1.endswith(s2):\n", + " print(True)\n", + "else:\n", + " print(False)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8rNqoCkHSbwf", + "outputId": "b600f0ef-ede8-4a79-f03b-452d5ead0be7" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "manager\n", + "man\n", + "True\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Letter,digit or special character" + ], + "metadata": { + "id": "jkY5SirFScvL" + } + }, + { + "cell_type": "code", + "source": [ + "c = input()\n", + "\n", + "if c.isdigit():\n", + " print(\"Digit\")\n", + "elif c.isupper():\n", + " print(\"Uppercase Letter\")\n", + "elif c.islower():\n", + " print(\"Lowercase Letter\")\n", + "else:\n", + " print(\"Special Character\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "WoIFJwTySitY", + "outputId": "0532458c-043d-40ba-b808-b4b5d1efd0b5" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "9\n", + "Digit\n" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/Day 19/Coding_Practice_11A.ipynb b/Day 19/Coding_Practice_11A.ipynb new file mode 100644 index 0000000..e82f60f --- /dev/null +++ b/Day 19/Coding_Practice_11A.ipynb @@ -0,0 +1,258 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "NRbVAhURXPFM", + "outputId": "f6786568-3003-484d-d053-fa866d0c1db4" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "--c--a--t--\n", + "cat\n" + ] + } + ], + "source": [ + "# Print Word\n", + "\n", + "word = input()\n", + "\n", + "word = word[2::3]\n", + "print(word)" + ] + }, + { + "cell_type": "code", + "source": [ + "# Pin number\n", + "\n", + "number = input()\n", + "\n", + "is_digit = number.isdigit()\n", + "print(is_digit)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Hih4rETZXeDY", + "outputId": "a0a043b6-3de2-49ac-c863-d141b7b094b2" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "12345\n", + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Strip cases\n", + "\n", + "word = input()\n", + "word = word.strip(\" \")\n", + "print(word)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "V_S74bePXf4k", + "outputId": "b12c240e-611d-4107-c15b-c3f3a642d205" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + " practices\n", + "practices\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Lowe case\n", + "\n", + "string = input()\n", + "string = string.lower()\n", + "print(string)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "5H0DnyV5Xj4n", + "outputId": "d6b7e9f7-79fd-4d0f-cf10-e4941a02160f" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "NOVEMBER\n", + "november\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Upper case\n", + "\n", + "string = input()\n", + "string1 = string.upper()\n", + "\n", + "if string == string1:\n", + " print(True)\n", + "else:\n", + " print(False)\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "RFLW5WMpXm8V", + "outputId": "702fa198-72ed-4fce-eb26-0a589f8fb32a" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "IEEE\n", + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Date Format\n", + "\n", + "date = input()\n", + "new_date = date.replace(\"-\",\"/\")\n", + "print(new_date)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "zs6N43u2Xohc", + "outputId": "6d8fef17-88e0-4ff3-84c6-48d8e0493da3" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "07-11-2020\n", + "07/11/2020\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Lowercase and Upeercase\n", + "\n", + "s = input()\n", + "\n", + "lower_s = s.lower()\n", + "upper_s = s.upper()\n", + "\n", + "print(lower_s)\n", + "print(upper_s)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "cBRcIlwRXswI", + "outputId": "d4fbf58a-abf0-4635-bc99-5cf851ff71f0" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Learning\n", + "learning\n", + "LEARNING\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Upper case Letters\n", + "\n", + "word = input()\n", + "result = \"\"\n", + "\n", + "for i in word:\n", + " if i == i.upper():\n", + " result = result + i\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "aqkPBM_lXvA1", + "outputId": "9d27aa0a-15ae-49cd-d86a-1132eebc058f" + }, + "execution_count": 1, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "SofTwArE\n", + "STAE\n" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/Day 19/Coding_Practice_11B.ipynb b/Day 19/Coding_Practice_11B.ipynb new file mode 100644 index 0000000..1dd41c3 --- /dev/null +++ b/Day 19/Coding_Practice_11B.ipynb @@ -0,0 +1,366 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "RD8eWZATTr3J", + "outputId": "612a7773-05ab-4c67-bc8f-b1a2262c9449" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "add_numbers.py\n", + "True\n" + ] + } + ], + "source": [ + "# Python File\n", + "\n", + "file = input()\n", + "is_py_file = file.endswith(\".py\")\n", + "\n", + "if is_py_file:\n", + " print(True)\n", + "else:\n", + " print(False)" + ] + }, + { + "cell_type": "code", + "source": [ + "# secured URL\n", + "\n", + "url = input()\n", + "\n", + "secure_ulr = url.startswith(\"https://\")\n", + "if secure_ulr:\n", + " print(True)\n", + "else:\n", + " print(False)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "wg5TxTXuULVr", + "outputId": "3e3d3add-0c7a-45ed-8300-6006f6a65729" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "https://docs.google.com\n", + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# swap case\n", + "\n", + "word = input()\n", + "word = word.swapcase()\n", + "print(word)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Qw_nn-eLUYWR", + "outputId": "5f405771-3366-498d-98da-953859d99a7b" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Humans\n", + "hUMANS\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Valid password - 2\n", + "\n", + "password = input()\n", + "\n", + "isall_lower = (password.lower() == password )\n", + "\n", + "if isall_lower:\n", + " print(\"Invalid Password\")\n", + "else:\n", + " print(\"Valid Password\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "jMnyM6JeUh0r", + "outputId": "6c0ee474-9d0d-4886-f300-7730337f874c" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Quraty00\n", + "Valid Password\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# palindrom - 2\n", + "\n", + "word = input()\n", + "new_word = \"\"\n", + "length = len(word)\n", + "for i in range(1,length + 1):\n", + " new_word = new_word + word[length - i]\n", + "\n", + "if word.lower() == new_word.lower() :\n", + " print(\"True\")\n", + "else:\n", + " print(\"False\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "lpdb-s4TUmkG", + "outputId": "ca8bf4b6-7a7f-4abe-ea2f-848e3d8ef13c" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "madam\n", + "True\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Valid Password - 3\n", + "\n", + "password = input()\n", + "\n", + "digit = False\n", + "\n", + "for i in password:\n", + " is_digit = i.isdigit()\n", + " if is_digit:\n", + " digit = True\n", + "\n", + "is_lower = not(password == password.lower())\n", + "is_upper = not(password == password.upper())\n", + "\n", + "condition = digit and is_upper and is_lower\n", + "\n", + "if condition:\n", + " print(\"Valid Password\")\n", + "else:\n", + " print(\"Invalid Password\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ZdnQCZA7UrWx", + "outputId": "329b44a5-09bd-4ede-c98b-5845c246ae5a" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Quraty000\n", + "Valid Password\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# case conversion - 2\n", + "\n", + "string = input()\n", + "\n", + "result = \"\"\n", + "\n", + "for i in string:\n", + " if i.isupper():\n", + " result = result + \"-\" + i.lower()\n", + " else:\n", + " result = result + i.lower()\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "uCih0aV7UuVp", + "outputId": "10330663-32c3-4e51-efc0-0f2b34722e08" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "aChristmasStory\n", + "a-christmas-story\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Valid Password\n", + "\n", + "password = input()\n", + "contain_digit = False\n", + "\n", + "for i in password:\n", + " if i.isdigit():\n", + " contain_digit = True\n", + "\n", + "if contain_digit:\n", + " print(\"Valid Password\")\n", + "else:\n", + " print(\"Invalid Password\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "72gwpiA7Uzsr", + "outputId": "6a4ef784-4b85-4b5c-ab1a-5b7f43eafe83" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Dashboard\n", + "Invalid Password\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# case conversion\n", + "\n", + "string = input()\n", + "\n", + "word = string[1:]\n", + "result = string[0]\n", + "\n", + "for i in word:\n", + " if i.isupper():\n", + " result = result + \" \" + i\n", + " else:\n", + " result = result + i\n", + "\n", + "print(result)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "VuEpl8EtU1sB", + "outputId": "5c5b3125-ac2a-4fd3-c4a7-112f900e8ff1" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "TitleCase\n", + "Title Case\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Palindrom\n", + "\n", + "string = input()\n", + "\n", + "reverse = \"\"\n", + "\n", + "for i in string:\n", + " reverse = i + reverse\n", + "\n", + "if reverse == string:\n", + " print(\"True\")\n", + "else:\n", + " print(\"False\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Kbum_GygU7gW", + "outputId": "f7ee9ead-c95e-4933-f221-07e61dd494c5" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "madam\n", + "True\n" + ] + } + ] + } + ] +} \ No newline at end of file