Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
276 changes: 276 additions & 0 deletions python/numpy_rup.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Assignment 2(List).ipynb",
"version": "0.3.2",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"[View in Colaboratory](https://colab.research.google.com/github/rupamcyrax799/Project-1-/blob/master/Assignment_2(List).ipynb)"
]
},
{
"metadata": {
"id": "wuw-V3ro-NJE",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "50469368-9731-4787-9344-9769f0650ea3"
},
"cell_type": "code",
"source": [
"dummy_list =[1,3,59,5,458,54,11,554]\n",
"print (dummy_list)\n",
"\n"
],
"execution_count": 17,
"outputs": [
{
"output_type": "stream",
"text": [
"[1, 3, 59, 5, 458, 54, 11, 554]\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "TJe1vgxkMyiH",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "c599c6d9-b819-4f51-83de-ba4ba928813d"
},
"cell_type": "code",
"source": [
"dummy_list.reverse()\n",
"print(dummy_list)\n"
],
"execution_count": 18,
"outputs": [
{
"output_type": "stream",
"text": [
"[554, 11, 54, 458, 5, 59, 3, 1]\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "fieJecpyM9U3",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "bb9da330-2be0-48de-c55e-4e5d590454a4"
},
"cell_type": "code",
"source": [
"dummy_list_2=[2,200,16,4,1,0,9.45,45.67,90,12.01,12.02]\n",
"dummy_list.extend(dummy_list_2)\n",
"print (dummy_list)\n"
],
"execution_count": 19,
"outputs": [
{
"output_type": "stream",
"text": [
"[554, 11, 54, 458, 5, 59, 3, 1, 2, 200, 16, 4, 1, 0, 9.45, 45.67, 90, 12.01, 12.02]\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "WEo-r280TzQr",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
"\n",
"l= len(dummy_list)\n",
"dummy_dict={}\n",
"i=0\n",
"for i in range(l) :\n",
" dummy_dict[dummy_list[i]]=i\n",
" if i==l:break;\n",
" \n",
" \n",
" "
],
"execution_count": 0,
"outputs": []
},
{
"metadata": {
"id": "54s6gajIxJrX",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "602119bb-df01-40f5-f663-3fab190fcbc7"
},
"cell_type": "code",
"source": [
"#printing the Dictionary\n",
"print(dummy_dict) "
],
"execution_count": 21,
"outputs": [
{
"output_type": "stream",
"text": [
"{554: 0, 11: 1, 54: 2, 458: 3, 5: 4, 59: 5, 3: 6, 1: 12, 2: 8, 200: 9, 16: 10, 4: 11, 0: 13, 9.45: 14, 45.67: 15, 90: 16, 12.01: 17, 12.02: 18}\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "klj9Ah-RxQ2i",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 51
},
"outputId": "ace0ddc5-cb96-4408-bddf-cf3e832bfbcf"
},
"cell_type": "code",
"source": [
"#Ascending Order\n",
"dummy_list.sort()\n",
"print(dummy_list)\n",
"#Decennding Order\n",
"dummy_list.sort(reverse=True)\n",
"print(dummy_list) "
],
"execution_count": 31,
"outputs": [
{
"output_type": "stream",
"text": [
"[0, 1, 1, 2, 3, 4, 5, 9.45, 11, 12.01, 12.02, 16, 45.67, 54, 59, 90, 200, 458, 554]\n",
"[554, 458, 200, 90, 59, 54, 45.67, 16, 12.02, 12.01, 11, 9.45, 5, 4, 3, 2, 1, 1, 0]\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "lmls5i5d0s5Y",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 51
},
"outputId": "960bc785-d1cb-4daf-adaf-ae879ed1f0bd"
},
"cell_type": "code",
"source": [
"#Removing elements in a list \n",
"print(dummy_list)\n",
"x=200\n",
"dummy_list.remove(x)\n",
"print(dummy_list)\n"
],
"execution_count": 32,
"outputs": [
{
"output_type": "stream",
"text": [
"[554, 458, 200, 90, 59, 54, 45.67, 16, 12.02, 12.01, 11, 9.45, 5, 4, 3, 2, 1, 1, 0]\n",
"[554, 458, 90, 59, 54, 45.67, 16, 12.02, 12.01, 11, 9.45, 5, 4, 3, 2, 1, 1, 0]\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "TZlOvze2zp3c",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 51
},
"outputId": "54b0be05-cbda-4084-e166-6c146c5215f6"
},
"cell_type": "code",
"source": [
"#Removing elemets input by the user\n",
"count=l+1\n",
"#print (count)\n",
"x= input (\"Enter a number greater than \"+str(count)+\":\")\n",
"dummy_list.remove(int(x))\n",
"print(dummy_list)"
],
"execution_count": 41,
"outputs": [
{
"output_type": "stream",
"text": [
"Enter a number greater than 20:90\n",
"[554, 458, 59, 54, 45.67, 16, 12.02, 12.01, 11, 9.45, 5, 4, 3, 2, 1, 1, 0]\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "wn-tvVmP9jW5",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "75eed0e5-6c88-4208-dd30-38ff1ef3668a"
},
"cell_type": "code",
"source": [
"#Clear list\n",
"dummy_list.clear()\n",
"print (dummy_list)\n"
],
"execution_count": 42,
"outputs": [
{
"output_type": "stream",
"text": [
"[]\n"
],
"name": "stdout"
}
]
}
]
}