diff --git a/Day 2 -- Assignment 1.ipynb b/Day 2 -- Assignment 1.ipynb new file mode 100644 index 0000000..b281012 --- /dev/null +++ b/Day 2 -- Assignment 1.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Day 2 -- Assignment 1\n", + " K Jaya Ganesh" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# File Handling" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I Love FCS\n" + ] + } + ], + "source": [ + "file = open(\"FCS.txt\", \"w\")\n", + "file.write(\"I Love FCS\")\n", + "file.close\n", + "file = open (\"FCS.txt\")\n", + "text = file.read()\n", + "print (text)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Day 2 -- Assignment 2.ipynb b/Day 2 -- Assignment 2.ipynb new file mode 100644 index 0000000..549a336 --- /dev/null +++ b/Day 2 -- Assignment 2.ipynb @@ -0,0 +1,84 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Day 2 -- Assignment 2\n", + " K Jaya Ganesh" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#printing students grade when marks are given" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your marks: 64\n", + "Your grade is D\n" + ] + } + ], + "source": [ + "#input module\n", + "\n", + "marks = int (input (\"Enter your marks: \"))\n", + "\n", + "#logic moduleS\n", + "\n", + "if (marks >= 85):\n", + " print (\"Your grade is A\")\n", + "elif (marks >= 75 and marks <= 84):\n", + " print (\"Your grade is B\")\n", + "elif (marks >= 65 and marks <= 74):\n", + " print (\"Your grade is C\")\n", + "elif (marks >= 55 and marks <= 64):\n", + " print (\"Your grade is D\")\n", + "elif (marks >= 45 and marks <= 54):\n", + " print (\"Your grade is E\")\n", + "else:\n", + " print (\"Need improvement\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Day 2 -- Assignment 3.ipynb b/Day 2 -- Assignment 3.ipynb new file mode 100644 index 0000000..262920e --- /dev/null +++ b/Day 2 -- Assignment 3.ipynb @@ -0,0 +1,83 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Day 2 -- Assignment 3\n", + " K Jaya Ganesh" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter your guess: 232\n", + "\n", + "try again\n", + "India's score is: 101\n", + "your guess is: 232\n" + ] + } + ], + "source": [ + "import random\n", + "\n", + "def game(i,r):\n", + " if i< 1 or i > 250:\n", + " print (\"your guess is is either too low or too high for an T20 match \") \n", + " elif abs(i - r) < 10: \n", + " print(\"\")\n", + " print (\"Guess is correct\")\n", + " print (\"India's score is: \", r)\n", + " print (\"your guess is: \",i)\n", + " else:\n", + " print(\"\")\n", + " print (\"try again\")\n", + " print (\"India's score is: \", r)\n", + " print (\"your guess is: \",i)\n", + "\n", + "#generating random number\n", + "r = random.randrange (1,251)\n", + "\n", + "#taking input from user\n", + "i = int(input(\"Enter your guess: \")) \n", + "\n", + "game(i,r)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Day 2 -- assignment 4.ipynb b/Day 2 -- assignment 4.ipynb new file mode 100644 index 0000000..b256d01 --- /dev/null +++ b/Day 2 -- assignment 4.ipynb @@ -0,0 +1,72 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Day 2 -- assignment 4\n", + " K Jaya Ganesh" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter Width of your photo: 450\n", + "Enter Height of your photo: 450\n", + "Image Accepted\n" + ] + } + ], + "source": [ + "#enter \n", + "\n", + "w = float(input(\"Enter Width of your photo: \"))\n", + "h = float(input(\"Enter Height of your photo: \"))\n", + "L = 450\n", + "\n", + "if w < L or h < L:\n", + " print (\"Upload another image\")\n", + "else:\n", + " if (w == L) and (h == L):\n", + " print (\"Image Accepted\")\n", + " else:\n", + " print (\"crop it\")\n", + " " + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Day 2 -- assignment 5.ipynb b/Day 2 -- assignment 5.ipynb new file mode 100644 index 0000000..3cfa48b --- /dev/null +++ b/Day 2 -- assignment 5.ipynb @@ -0,0 +1,84 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Day 2 -- Assignment 5\n", + " K Jaya Ganesh" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter u/d/l/r: u\n", + "your curret position is: [0, 1]\n", + "enter u/d/l/r: u\n", + "your curret position is: [0, 2]\n", + "enter u/d/l/r: l\n", + "your curret position is: [-1, 2]\n", + "enter u/d/l/r: l\n", + "your curret position is: [-2, 2]\n" + ] + } + ], + "source": [ + "i = [0,0]\n", + "\n", + "\n", + "def move(v):\n", + " if v == \"u\":\n", + " i[1] = i[1] + 1\n", + " print(\"your curret position is: \", i)\n", + " elif v == \"d\":\n", + " i[1] = i[1] - 1\n", + " print(\"your curret position is: \", i)\n", + " elif v == \"l\":\n", + " i[0] = i[0] - 1\n", + " print(\"your curret position is: \", i)\n", + " elif v == \"r\":\n", + " i[0] = i[0] + 1\n", + " print(\"your curret position is: \", i)\n", + " \n", + "x = 2\n", + "while x > 0 :\n", + " v = str(input(\"enter u/d/l/r: \"))\n", + " move(v)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}