{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "1d8bfef7",
   "metadata": {},
   "outputs": [],
   "source": [
    "l= [x for x in range(1,10001) if x%7==0 and x%13==0 and x%17==0]\n",
    "d= dict(zip(range(1,len(l)+1),  l))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "447cd9dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1: 1547, 2: 3094, 3: 4641, 4: 6188, 5: 7735, 6: 9282}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "17f3bc39",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1547"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "ea65e073",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1547"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.pop(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "9c0427fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(6, 9282)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.popitem()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "8b46ce21",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_values([3094, 4641, 6188, 7735])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.values()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "a716746f",
   "metadata": {},
   "outputs": [],
   "source": [
    "s= 'hi hhow are you'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "39159c10",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Hi Hhow Are You'"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.title()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "a005e224",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(s.split(' '))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "8f241de3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "c9cc50b4",
   "metadata": {},
   "outputs": [],
   "source": [
    "l=list(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "ea6eb40c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['h', 'i', ' ', 'h', 'h', 'o', 'w', ' ', 'a', 'r', 'e', ' ', 'y', 'o', 'u']"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "b9bfd234",
   "metadata": {},
   "outputs": [],
   "source": [
    "d = {\n",
    "  \"name\": \"Dog\",\n",
    "  \"age\":5,\n",
    "  \"Weight\": 4,\n",
    "  \"Country\": \"US\",\n",
    "  \"City\":\"California\"\n",
    "   \n",
    "}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "a361e0a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'name': 'Dog', 'age': 5}"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict(zip(['name', 'age'], [d['name'], d['age']]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "c0bb82c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "del d['name'], d['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5bb63b58",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "e9225663",
   "metadata": {},
   "outputs": [],
   "source": [
    "d= {'b':5,'a':1,'D':4}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "90e6175a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n",
      "1\n",
      "5\n"
     ]
    }
   ],
   "source": [
    "for _ in sorted(d):\n",
    "    print(d[_])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "2b6811aa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2550608643392"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(d)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "e5c5970c",
   "metadata": {},
   "outputs": [],
   "source": [
    "d['animalname']= d.pop('name')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "45282325",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'age': 5,\n",
       " 'Weight': 4,\n",
       " 'Country': 'US',\n",
       " 'City': 'California',\n",
       " 'animalname': 'Dog'}"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "71e96cdb",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "unhashable type: 'list'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-65-fa3104c36ec4>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0md\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'age'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'animalname'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: unhashable type: 'list'"
     ]
    }
   ],
   "source": [
    "d[['age','animalname']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "4ef785be",
   "metadata": {},
   "outputs": [],
   "source": [
    "if 'age' in d:\n",
    "    del d['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "31af363e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Weight': 4, 'Country': 'US', 'City': 'California', 'animalname': 'Dog'}"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "d964f89e",
   "metadata": {},
   "outputs": [],
   "source": [
    "d.get?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "936ed7d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'a'"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "min(d, key= d.get)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "01807f4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'b': 5, 'a': 1, 'D': 4}"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "ee25a88c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['b', 'D']"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sorted(d, key= d.get,reverse=1)[:2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "175ab083",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "8a96eb7e",
   "metadata": {},
   "outputs": [],
   "source": [
    "d= {'Fr   uit':['Apple','Banana','Orange'],'Sub   ject':['Phy','Math','English']}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "d1429c18",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Fruit': ['Apple', 'Banana', 'Orange'], 'Subject': ['Phy', 'Math', 'English']}"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "{x.replace(' ',''):d[x] for x in d.keys()}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "06bc699e",
   "metadata": {},
   "outputs": [],
   "source": [
    "d = {'lang': 'C#', 'Fruit': 'Apple', 'Subj':None,'Animal':None}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "b1644bb8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'lang': 'C#', 'Fruit': 'Apple'}"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "{i: j for i,j in d.items() if j != None}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "bcad3afe",
   "metadata": {},
   "outputs": [],
   "source": [
    "d={'Racx': 12000, 'Max':80000,'Stack':80000,'John':80000,}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "b8c8087f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{12000: 1, 80000: 3}"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "{x : list(d.values()).count(x) for x in set(d.values())}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6fc08bcc",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0b7dee95",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "0030c540",
   "metadata": {},
   "outputs": [],
   "source": [
    "s= 'hi how are you'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "a7e63c02",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'you are how hi'"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "' '.join(reversed(s.split(' ')))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "id": "50f79b95",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['h', ' ', 'o', ' ', 'r', ' ', 'o']"
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[s[i] for i in range(len(s)) if i%2==0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "id": "124f9024",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.startswith('hi')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "id": "0b175b7d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.endswith('bye')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "id": "d1cc2d5b",
   "metadata": {},
   "outputs": [],
   "source": [
    "s= '\\nPython String\\n with\\n newline\\n'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "id": "03a5ee12",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Python String\n",
      " with\n",
      " newline\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "id": "2fd9a97b",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 = \"Python is Amazing\"\n",
    "s2 = \"PythonProgram\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "5f9d59e3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9"
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len([x for x in set(s1) if x in set(s2)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "id": "2dcd5631",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Python', 'is', 'Amazing']"
      ]
     },
     "execution_count": 138,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.split(' ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "51b0f8b9",
   "metadata": {},
   "outputs": [],
   "source": [
    "{'Lower': }"
   ]
  }
 ],
 "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.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
