|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "# Q1 - WAP for taking one number a input and then using if elif else concept, assign a grade to the input number from \n", |
| 10 | + "\n", |
| 11 | + "#A,B,C,D,E, Fail\n", |
| 12 | + "\n", |
| 13 | + "#In a formatted report card\n", |
| 14 | + "\n", |
| 15 | + "#|------|\n", |
| 16 | + "#| A |\n", |
| 17 | + "#|_____|\n", |
| 18 | + "\n", |
| 19 | + "\n" |
| 20 | + ] |
| 21 | + }, |
| 22 | + { |
| 23 | + "cell_type": "code", |
| 24 | + "execution_count": 19, |
| 25 | + "metadata": {}, |
| 26 | + "outputs": [ |
| 27 | + { |
| 28 | + "name": "stdout", |
| 29 | + "output_type": "stream", |
| 30 | + "text": [ |
| 31 | + "Enter your marks - 78\n", |
| 32 | + "|--------|\n", |
| 33 | + "| B |\n", |
| 34 | + "|--------|\n" |
| 35 | + ] |
| 36 | + } |
| 37 | + ], |
| 38 | + "source": [ |
| 39 | + "#Assignment 1 - \n", |
| 40 | + "\n", |
| 41 | + "marks = int(input(\"Enter your marks - \"))\n", |
| 42 | + "\n", |
| 43 | + "print('|--------|')\n", |
| 44 | + "if(marks >= 85):\n", |
| 45 | + " print(\"| A |\")\n", |
| 46 | + "elif (marks>=75 and marks <= 84):\n", |
| 47 | + " print(\"| B |\")\n", |
| 48 | + "elif (marks>=65 and marks <= 74):\n", |
| 49 | + " print(\"| C |\")\n", |
| 50 | + "elif (marks>=55 and marks <= 64):\n", |
| 51 | + " print(\"| D |\")\n", |
| 52 | + "elif (marks>=45 and marks <= 54):\n", |
| 53 | + " print(\"| E |\")\n", |
| 54 | + "else:\n", |
| 55 | + " print(\"Need imporvement\")\n", |
| 56 | + " \n", |
| 57 | + "print('|--------|')\n" |
| 58 | + ] |
| 59 | + }, |
| 60 | + { |
| 61 | + "cell_type": "code", |
| 62 | + "execution_count": 7, |
| 63 | + "metadata": {}, |
| 64 | + "outputs": [ |
| 65 | + { |
| 66 | + "name": "stdout", |
| 67 | + "output_type": "stream", |
| 68 | + "text": [ |
| 69 | + "Computer Generated Team India Cricket Score - 58\n", |
| 70 | + "enter your guess 55\n", |
| 71 | + "Close by, you are True Indian Fan!\n" |
| 72 | + ] |
| 73 | + } |
| 74 | + ], |
| 75 | + "source": [ |
| 76 | + "# Assignment 2 - \n", |
| 77 | + "\n", |
| 78 | + "#Generating computer Score module \n", |
| 79 | + "\n", |
| 80 | + "from random import randint \n", |
| 81 | + "\n", |
| 82 | + "computer_generated_team_india_score = randint(1,250)\n", |
| 83 | + "print(\"Computer Generated Team India Cricket Score - \",computer_generated_team_india_score)\n", |
| 84 | + "\n", |
| 85 | + "#Guessing module --- \n", |
| 86 | + "while True:\n", |
| 87 | + " user_input = int(input(\"enter your guess \"))\n", |
| 88 | + " if(user_input>=1 and user_input<=250):\n", |
| 89 | + " break\n", |
| 90 | + " else:\n", |
| 91 | + " print(\"Reduce your expectation for 20-20 Cricket. Enter your number again\")\n", |
| 92 | + "\n", |
| 93 | + "#Checking whether the number is near by yes or no \n", |
| 94 | + "diffeence = abs(user_input - computer_generated_team_india_score)\n", |
| 95 | + "\n", |
| 96 | + "if ( diffeence <=10 and diffeence >=1):\n", |
| 97 | + " print(\"Close by, you are True Indian Fan!\")\n", |
| 98 | + "else:\n", |
| 99 | + " print(\"You don't watch that much! :P\")" |
| 100 | + ] |
| 101 | + }, |
| 102 | + { |
| 103 | + "cell_type": "code", |
| 104 | + "execution_count": 4, |
| 105 | + "metadata": {}, |
| 106 | + "outputs": [], |
| 107 | + "source": [ |
| 108 | + "# Assignment 3 - \n", |
| 109 | + "\n", |
| 110 | + "\n", |
| 111 | + "file = open(\"assignment5.txt\",'w')\n", |
| 112 | + "\n", |
| 113 | + "file.write(\"I love and live for FCS\")\n", |
| 114 | + "\n", |
| 115 | + "file.close()\n" |
| 116 | + ] |
| 117 | + }, |
| 118 | + { |
| 119 | + "cell_type": "code", |
| 120 | + "execution_count": 6, |
| 121 | + "metadata": {}, |
| 122 | + "outputs": [ |
| 123 | + { |
| 124 | + "name": "stdout", |
| 125 | + "output_type": "stream", |
| 126 | + "text": [ |
| 127 | + "I love and live for FCS\n" |
| 128 | + ] |
| 129 | + } |
| 130 | + ], |
| 131 | + "source": [ |
| 132 | + "file = open(\"assignment5.txt\",'r')\n", |
| 133 | + "\n", |
| 134 | + "print(file.read())\n", |
| 135 | + "\n", |
| 136 | + "file.close()" |
| 137 | + ] |
| 138 | + }, |
| 139 | + { |
| 140 | + "cell_type": "code", |
| 141 | + "execution_count": 10, |
| 142 | + "metadata": {}, |
| 143 | + "outputs": [ |
| 144 | + { |
| 145 | + "name": "stdout", |
| 146 | + "output_type": "stream", |
| 147 | + "text": [ |
| 148 | + "Enter number of chances you want a user to upload ?2\n", |
| 149 | + "Enter the min Length ?10\n", |
| 150 | + "Enter ur Height of photo ?0\n", |
| 151 | + "Enter ur Width of the photo ?0\n", |
| 152 | + "minimum photo size should be four - 10\n", |
| 153 | + "Enter ur Height of photo ?10\n", |
| 154 | + "Enter ur Width of the photo ?20\n", |
| 155 | + "Crop it\n" |
| 156 | + ] |
| 157 | + } |
| 158 | + ], |
| 159 | + "source": [ |
| 160 | + "# Assignment 4 -- \n", |
| 161 | + "\n", |
| 162 | + "# L, N, W, H\n", |
| 163 | + "# how many times u want to upload a Photo ? \n", |
| 164 | + "n = int(input(\"Enter number of chances you want a user to upload ?\"))\n", |
| 165 | + "\n", |
| 166 | + "#Enter the Lenght size \n", |
| 167 | + "l = int(input(\"Enter the min Length ?\"))\n", |
| 168 | + "\n", |
| 169 | + "curent_operation = 0\n", |
| 170 | + "while(curent_operation<n):\n", |
| 171 | + " curent_operation += 1\n", |
| 172 | + " \n", |
| 173 | + " h = int(input(\"Enter ur Height of photo ?\"))\n", |
| 174 | + " w = int(input(\"Enter ur Width of the photo ?\"))\n", |
| 175 | + " \n", |
| 176 | + " if ( h >= l and w >=l):\n", |
| 177 | + " if(h==w):\n", |
| 178 | + " print(\"Accepted\")\n", |
| 179 | + " else:\n", |
| 180 | + " print(\"Crop it\")\n", |
| 181 | + " else:\n", |
| 182 | + " print(\"minimum photo size should be - \", l )" |
| 183 | + ] |
| 184 | + }, |
| 185 | + { |
| 186 | + "cell_type": "code", |
| 187 | + "execution_count": null, |
| 188 | + "metadata": {}, |
| 189 | + "outputs": [], |
| 190 | + "source": [ |
| 191 | + "# Assignment 5\n", |
| 192 | + "\n", |
| 193 | + "ankit_x = 0 \n", |
| 194 | + "ankit_y = 0 \n", |
| 195 | + "\n", |
| 196 | + "max_move = 0\n", |
| 197 | + "\n", |
| 198 | + "while(max_move <= 5):\n", |
| 199 | + " max_move += 1\n", |
| 200 | + " command = input(\"Enter the Command for ankit to move - \")\n", |
| 201 | + " command = command.lower()\n", |
| 202 | + " \n", |
| 203 | + " if(command == \"l\"):\n", |
| 204 | + " ankit_x += -1\n", |
| 205 | + " elif (command == \"r\"):\n", |
| 206 | + " ankit_x += +1\n", |
| 207 | + " elif (command == \"u\"):\n", |
| 208 | + " ankit_y += 1\n", |
| 209 | + " elif( command == \"d\"):\n", |
| 210 | + " ankit_y -= 1\n", |
| 211 | + " else: \n", |
| 212 | + " print(\"Enter valid input, L,R,U,D\")\n", |
| 213 | + " \n", |
| 214 | + " print(\"ankit is here - \", ankit_x, ankit_y)\n", |
| 215 | + " " |
| 216 | + ] |
| 217 | + }, |
| 218 | + { |
| 219 | + "cell_type": "code", |
| 220 | + "execution_count": null, |
| 221 | + "metadata": {}, |
| 222 | + "outputs": [], |
| 223 | + "source": [] |
| 224 | + } |
| 225 | + ], |
| 226 | + "metadata": { |
| 227 | + "kernelspec": { |
| 228 | + "display_name": "Python 3", |
| 229 | + "language": "python", |
| 230 | + "name": "python3" |
| 231 | + }, |
| 232 | + "language_info": { |
| 233 | + "codemirror_mode": { |
| 234 | + "name": "ipython", |
| 235 | + "version": 3 |
| 236 | + }, |
| 237 | + "file_extension": ".py", |
| 238 | + "mimetype": "text/x-python", |
| 239 | + "name": "python", |
| 240 | + "nbconvert_exporter": "python", |
| 241 | + "pygments_lexer": "ipython3", |
| 242 | + "version": "3.7.6" |
| 243 | + } |
| 244 | + }, |
| 245 | + "nbformat": 4, |
| 246 | + "nbformat_minor": 2 |
| 247 | +} |
0 commit comments