Skip to content

Commit e3005bc

Browse files
2 parents 19825d6 + b081caf commit e3005bc

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

temp.ipynb

+38
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5+
<<<<<<< HEAD
56
"execution_count": 49,
67
"metadata": {},
78
"outputs": [
@@ -20,15 +21,52 @@
2021
"# 1,2,3,4,5,6,7,8,9\n",
2122
"# Then, the output should be:\n",
2223
"# 1,3,5,7,9\n",
24+
=======
25+
"execution_count": 83,
26+
"metadata": {},
27+
"outputs": [
28+
{
29+
"data": {
30+
"text/plain": [
31+
"'a,b,hola,que'"
32+
]
33+
},
34+
"execution_count": 83,
35+
"metadata": {},
36+
"output_type": "execute_result"
37+
}
38+
],
39+
"source": [
40+
"# Write a program that accepts a sequence of whitespace separated words as input and prints the words after removing all duplicate words and sorting them alphanumerically.\n",
41+
"# Suppose the following input is supplied to the program:\n",
42+
"# hello world and practice makes perfect and hello world again\n",
43+
"# Then, the output should be:\n",
44+
"# again and hello makes perfect practice world\n",
45+
>>>>>>> 860ad1bf6a0746d51c1cbae1094d60f93815ba4c
2346
"\n",
47+
"list_word = input('Write some words: ').split(' ')\n",
2448
"\n",
49+
<<<<<<< HEAD
2550
"list_word = (input('Write some words: ')).split(',')\n",
2651
"new_list = []\n",
2752
"for word in list_word:\n",
2853
" if(int(word)%2 != 0):\n",
2954
" new_list.append(str(int(word)**2))\n",
3055
" \n",
3156
"print(','.join(new_list))"
57+
=======
58+
"from collections import defaultdict\n",
59+
"\n",
60+
"temp_dict = defaultdict(int)\n",
61+
"for word in list_word:\n",
62+
" temp_dict[word] += 1\n",
63+
"\n",
64+
"temp_list = list(temp_dict.keys())\n",
65+
"\n",
66+
"temp_list.sort()\n",
67+
"\n",
68+
"','.join(temp_list)"
69+
>>>>>>> 860ad1bf6a0746d51c1cbae1094d60f93815ba4c
3270
]
3371
}
3472
],

0 commit comments

Comments
 (0)