Skip to content

Commit d393ccd

Browse files
committed
Updated new tasks and solution to existing ones.
1 parent 64b235b commit d393ccd

File tree

7 files changed

+220
-12
lines changed

7 files changed

+220
-12
lines changed

Diff for: Tasks/0004.ipynb

+30
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,36 @@
8282
"\telse:\n",
8383
"\t\tprint(string+\" can be made a palindrome\")"
8484
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": 2,
89+
"metadata": {},
90+
"outputs": [
91+
{
92+
"name": "stdout",
93+
"output_type": "stream",
94+
"text": [
95+
"Enter your string : hello\n",
96+
"It can't be a Palindrome\n"
97+
]
98+
}
99+
],
100+
"source": [
101+
"# By --- Krat0s\n",
102+
"\n",
103+
"val ,check= input(\"Enter your string : \"),0\n",
104+
"if val.lower() == val[::-1].lower():\n",
105+
" print(\"It's a Palindrome\")\n",
106+
"else:\n",
107+
" for a in sorted(val):\n",
108+
" if val.count(a)%2:\n",
109+
" check+=1\n",
110+
"if check <= 1:\n",
111+
" print(\"It can be made Palindrome\")\n",
112+
"if check > 1:\n",
113+
" print(\"It can't be a Palindrome\")"
114+
]
85115
}
86116
],
87117
"metadata": {

Diff for: Tasks/0007.ipynb

+30
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,36 @@
4242
" str2+=i+str(str1.count(i))\n",
4343
"print(str2)"
4444
]
45+
},
46+
{
47+
"cell_type": "code",
48+
"execution_count": 2,
49+
"metadata": {},
50+
"outputs": [
51+
{
52+
"name": "stdout",
53+
"output_type": "stream",
54+
"text": [
55+
"Enter a string:xxXXXXXAAABBcCDDDEEEEccc\n",
56+
"x2X5A3B2c1C1D3E4c3\n"
57+
]
58+
}
59+
],
60+
"source": [
61+
"# Solution provided by --- Krat0s\n",
62+
"\n",
63+
"val=input(\"Enter a string:\")\n",
64+
"val+=\" \"\n",
65+
"c,x,count=\"\",\"\",0\n",
66+
"for a in range(len(val)):\n",
67+
" if x==val[a]:\n",
68+
" count+=1\n",
69+
" else:\n",
70+
" c += x + str(count)\n",
71+
" x=val[a]\n",
72+
" count=1\n",
73+
"print(c[1:])"
74+
]
4575
}
4676
],
4777
"metadata": {

Diff for: Tasks/0008.ipynb

+23
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,29 @@
4747
"need=need/10\n",
4848
"print(need,'ltrs')"
4949
]
50+
},
51+
{
52+
"cell_type": "code",
53+
"execution_count": 1,
54+
"metadata": {},
55+
"outputs": [
56+
{
57+
"name": "stdout",
58+
"output_type": "stream",
59+
"text": [
60+
"Enter bottles with amount of water filled : 5,4,10,0,8,7,6\n",
61+
"Enter Bottles Capacity in litres: 1\n",
62+
"3.0 ltres\n"
63+
]
64+
}
65+
],
66+
"source": [
67+
"# Solution provided by --- Krat0s\n",
68+
"\n",
69+
"bottles,result=input(\"Enter bottles with amount of water filled : \"),0\n",
70+
"cap=int(input(\"Enter Bottles Capacity in litres: \"))\n",
71+
"print(sum(map(lambda x:(cap*10)-int(x),bottles.replace(\",\",\" \").split()))/10,\"ltres\")"
72+
]
5073
}
5174
],
5275
"metadata": {

Diff for: Tasks/0009.ipynb

+32-5
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,23 @@
3939
},
4040
{
4141
"cell_type": "code",
42-
"execution_count": 2,
42+
"execution_count": 7,
4343
"metadata": {},
4444
"outputs": [
4545
{
4646
"name": "stdout",
4747
"output_type": "stream",
4848
"text": [
49-
"(6, 5)\n",
50-
"(10, 3)\n",
51-
"(30, 1)\n"
49+
"(6, 4)\n",
50+
"(8, 3)\n"
5251
]
5352
}
5453
],
5554
"source": [
5655
"# By ---> ʀᴏʜɪᴛʜ ᴋᴜᴍᴀʀ\n",
5756
"\n",
5857
"numbers=[1,2,3,4,5,6,7,8,9,10,20,30]\n",
59-
"x=30\n",
58+
"x=24\n",
6059
"dict={}\n",
6160
"for index,number in enumerate(numbers):\n",
6261
"\tif number in dict:\n",
@@ -96,6 +95,34 @@
9695
"\n",
9796
"print(list1)"
9897
]
98+
},
99+
{
100+
"cell_type": "code",
101+
"execution_count": 5,
102+
"metadata": {},
103+
"outputs": [
104+
{
105+
"name": "stdout",
106+
"output_type": "stream",
107+
"text": [
108+
"Enter your value : 24\n",
109+
"(3, 8)(6, 4)\n"
110+
]
111+
}
112+
],
113+
"source": [
114+
"# Solution provided by --- Krat0s\n",
115+
"\n",
116+
"array=[1,2,3,4,5,6,7,8,9,10,20,30]\n",
117+
"val,res=int(input(\"Enter your value : \")),\"\"\n",
118+
"for a in array:\n",
119+
" for i in array:\n",
120+
" if a*i==val and not((a,i) in tuple(res)):\n",
121+
" res+=str((a,i))\n",
122+
" array.remove(a)\n",
123+
" array.remove(i)\n",
124+
"print(str(res))"
125+
]
99126
}
100127
],
101128
"metadata": {

Diff for: Tasks/0021.ipynb

+24
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,30 @@
3838
"ar.append(ar.pop(0))\n",
3939
"print(ar)"
4040
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": 1,
45+
"metadata": {},
46+
"outputs": [
47+
{
48+
"name": "stdout",
49+
"output_type": "stream",
50+
"text": [
51+
"input the list: [1,2,3,4,5,6,7,8,9]\n",
52+
"[2,3,4,5,6,7,8,9,1]\n"
53+
]
54+
}
55+
],
56+
"source": [
57+
"# By --- Henok\n",
58+
"\n",
59+
"x = input(\"input the list: \")\n",
60+
"y = x[3: len(x) - 1]\n",
61+
"y1 = x[1]\n",
62+
"conc = \"[\" + y + \",\" + y1 + \"]\"\n",
63+
"print(conc)"
64+
]
4165
}
4266
],
4367
"metadata": {

Diff for: Tasks/0022.ipynb

+48-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,56 @@
2121
},
2222
{
2323
"cell_type": "code",
24-
"execution_count": null,
24+
"execution_count": 1,
2525
"metadata": {},
26-
"outputs": [],
26+
"outputs": [
27+
{
28+
"name": "stdout",
29+
"output_type": "stream",
30+
"text": [
31+
"[5, 5, 5, 5, 5]\n",
32+
"[5, 5, 5, 5, 5]\n"
33+
]
34+
}
35+
],
2736
"source": [
28-
"# Solution will be posted shortly"
37+
"# By --- ʀᴏʜɪᴛʜ ᴋᴜᴍᴀʀ\n",
38+
"\n",
39+
"def in_built(arr):\t\n",
40+
"\tprint([max(arr)]*len(arr))\t#Printing max value length of arr times\n",
41+
"\t\n",
42+
"def add_on(arr):\n",
43+
"\tln=len(arr)\n",
44+
"\tmx=arr[0]\n",
45+
"\tfor i in range(1,ln):\n",
46+
"\t\tif arr[i]>mx:\n",
47+
"\t\t\tmx=arr[i]\t#max value stored in mx\n",
48+
"\tprint([mx]*ln)\n",
49+
"in_built([1,2,3,4,5])\n",
50+
"add_on([1,2,3,4,5])"
51+
]
52+
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": 2,
56+
"metadata": {},
57+
"outputs": [
58+
{
59+
"name": "stdout",
60+
"output_type": "stream",
61+
"text": [
62+
"[54, 54, 54, 54, 54]\n"
63+
]
64+
}
65+
],
66+
"source": [
67+
"# By --- Shreyash Musale\n",
68+
"\n",
69+
"li=[12,54,33,16,9]\n",
70+
"li.sort()\n",
71+
"max=li[-1]\n",
72+
"li=[max]*len(li)\n",
73+
"print(li)"
2974
]
3075
}
3176
],

0 commit comments

Comments
 (0)