|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 6, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "import numpy as np\n", |
| 10 | + "list1=[1,2,3,4]\n", |
| 11 | + "list2=[4,5,6,7]\n", |
| 12 | + "arr = np.array([list1,list2])\n", |
| 13 | + "arr.shape\n", |
| 14 | + "list3=[24,26,37,48]\n", |
| 15 | + "list4=[41,52,61,70]\n", |
| 16 | + "arr1 = np.array([list3,list4])" |
| 17 | + ] |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "code", |
| 21 | + "execution_count": 13, |
| 22 | + "metadata": {}, |
| 23 | + "outputs": [ |
| 24 | + { |
| 25 | + "data": { |
| 26 | + "text/plain": [ |
| 27 | + "array([[3, 5],\n", |
| 28 | + " [7, 9]])" |
| 29 | + ] |
| 30 | + }, |
| 31 | + "execution_count": 13, |
| 32 | + "metadata": {}, |
| 33 | + "output_type": "execute_result" |
| 34 | + } |
| 35 | + ], |
| 36 | + "source": [ |
| 37 | + "res = arr+arr1\n", |
| 38 | + "res" |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + "cell_type": "code", |
| 43 | + "execution_count": 9, |
| 44 | + "metadata": {}, |
| 45 | + "outputs": [], |
| 46 | + "source": [ |
| 47 | + "list1=[2,3]\n", |
| 48 | + "list2=[4,5]\n", |
| 49 | + "arr = np.array([list1,list2])\n", |
| 50 | + "arr.shape\n", |
| 51 | + "list3=[1,2,]\n", |
| 52 | + "list4=[3,4]\n", |
| 53 | + "arr1 = np.array([list3,list4])" |
| 54 | + ] |
| 55 | + }, |
| 56 | + { |
| 57 | + "cell_type": "code", |
| 58 | + "execution_count": 10, |
| 59 | + "metadata": {}, |
| 60 | + "outputs": [ |
| 61 | + { |
| 62 | + "data": { |
| 63 | + "text/plain": [ |
| 64 | + "array([[ 2, 6],\n", |
| 65 | + " [12, 20]])" |
| 66 | + ] |
| 67 | + }, |
| 68 | + "execution_count": 10, |
| 69 | + "metadata": {}, |
| 70 | + "output_type": "execute_result" |
| 71 | + } |
| 72 | + ], |
| 73 | + "source": [ |
| 74 | + "t = arr*arr1\n", |
| 75 | + "t" |
| 76 | + ] |
| 77 | + }, |
| 78 | + { |
| 79 | + "cell_type": "code", |
| 80 | + "execution_count": 20, |
| 81 | + "metadata": {}, |
| 82 | + "outputs": [ |
| 83 | + { |
| 84 | + "data": { |
| 85 | + "text/plain": [ |
| 86 | + "array([[56, 78],\n", |
| 87 | + " [34, 90]])" |
| 88 | + ] |
| 89 | + }, |
| 90 | + "execution_count": 20, |
| 91 | + "metadata": {}, |
| 92 | + "output_type": "execute_result" |
| 93 | + } |
| 94 | + ], |
| 95 | + "source": [ |
| 96 | + "list7 = [56,34]\n", |
| 97 | + "list3=[78,90]\n", |
| 98 | + "arr2=np.array([list7,list3])\n", |
| 99 | + "k=arr2.transpose()\n", |
| 100 | + "k" |
| 101 | + ] |
| 102 | + }, |
| 103 | + { |
| 104 | + "cell_type": "code", |
| 105 | + "execution_count": 39, |
| 106 | + "metadata": {}, |
| 107 | + "outputs": [ |
| 108 | + { |
| 109 | + "name": "stdout", |
| 110 | + "output_type": "stream", |
| 111 | + "text": [ |
| 112 | + "None\n" |
| 113 | + ] |
| 114 | + } |
| 115 | + ], |
| 116 | + "source": [ |
| 117 | + "p=['a','c','d']\n", |
| 118 | + "g=p.sort()\n", |
| 119 | + "print(g)" |
| 120 | + ] |
| 121 | + }, |
| 122 | + { |
| 123 | + "cell_type": "code", |
| 124 | + "execution_count": 41, |
| 125 | + "metadata": {}, |
| 126 | + "outputs": [ |
| 127 | + { |
| 128 | + "name": "stdout", |
| 129 | + "output_type": "stream", |
| 130 | + "text": [ |
| 131 | + "Enter any sentence: My name is Akash Borgalli\n", |
| 132 | + "The sorted words are:\n", |
| 133 | + "akash\n", |
| 134 | + "borgalli\n", |
| 135 | + "is\n", |
| 136 | + "my\n", |
| 137 | + "name\n" |
| 138 | + ] |
| 139 | + } |
| 140 | + ], |
| 141 | + "source": [ |
| 142 | + "str = input(\"Enter any sentence: \")\n", |
| 143 | + "words = [word.lower() for word in str.split()]\n", |
| 144 | + "words.sort()\n", |
| 145 | + "print(\"The sorted words are:\")\n", |
| 146 | + "for word in words:\n", |
| 147 | + " print(word)" |
| 148 | + ] |
| 149 | + }, |
| 150 | + { |
| 151 | + "cell_type": "code", |
| 152 | + "execution_count": 70, |
| 153 | + "metadata": {}, |
| 154 | + "outputs": [ |
| 155 | + { |
| 156 | + "name": "stdout", |
| 157 | + "output_type": "stream", |
| 158 | + "text": [ |
| 159 | + "Akash is good boy\n" |
| 160 | + ] |
| 161 | + } |
| 162 | + ], |
| 163 | + "source": [ |
| 164 | + "def Punctuation(newstring):\n", |
| 165 | + " punctuations = '''!()-[]{};:'\"\\,<>./?@#$%^&*_~'''\n", |
| 166 | + " for i in newstring.lower():\n", |
| 167 | + " if i in punctuations:\n", |
| 168 | + " newstring = newstring.replace(i, \"\")\n", |
| 169 | + " print(newstring)\n", |
| 170 | + "string = \"A*k*a@s!h #is$% g%#o#o^d# $%b^o&y\"\n", |
| 171 | + "Punctuation(string)" |
| 172 | + ] |
| 173 | + } |
| 174 | + ], |
| 175 | + "metadata": { |
| 176 | + "kernelspec": { |
| 177 | + "display_name": "Python 3", |
| 178 | + "language": "python", |
| 179 | + "name": "python3" |
| 180 | + }, |
| 181 | + "language_info": { |
| 182 | + "codemirror_mode": { |
| 183 | + "name": "ipython", |
| 184 | + "version": 3 |
| 185 | + }, |
| 186 | + "file_extension": ".py", |
| 187 | + "mimetype": "text/x-python", |
| 188 | + "name": "python", |
| 189 | + "nbconvert_exporter": "python", |
| 190 | + "pygments_lexer": "ipython3", |
| 191 | + "version": "3.8.5" |
| 192 | + } |
| 193 | + }, |
| 194 | + "nbformat": 4, |
| 195 | + "nbformat_minor": 4 |
| 196 | +} |
0 commit comments