File tree Expand file tree Collapse file tree 4 files changed +51
-0
lines changed Expand file tree Collapse file tree 4 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ input_string = input ('enter a string : ' )
2
+ frequency = {}
3
+ for i in input_string :
4
+ if i in frequency :
5
+ frequency [i ] += 1
6
+ else :
7
+ frequency [i ] = 1
8
+ print (frequency )
9
+
10
+
Original file line number Diff line number Diff line change
1
+ input_string = input ('enter a string : ' )
2
+ string_ = input_string .lower ()
3
+ frequency = {}
4
+ for i in string_ :
5
+ if i in frequency :
6
+ frequency [i ] += 1
7
+ else :
8
+ frequency [i ] = 1
9
+ print (frequency )
10
+
11
+
Original file line number Diff line number Diff line change
1
+ map_ = {}
2
+ while True :
3
+ list_ = input ("enter command : " )
4
+ cond = list_ .split ()
5
+ if cond [0 ]== 'stop' :
6
+ break
7
+
8
+ else :
9
+ if cond [0 ] in map_ :
10
+ print ("in if" )
11
+ map_ [cond [0 ]].add (cond [1 ])
12
+ else :
13
+ print ("in else" )
14
+ map_ [cond [0 ]]= {cond [1 ]}
15
+ print (map_ )
Original file line number Diff line number Diff line change
1
+ lst = []
2
+ while True :
3
+ commands = input ()
4
+ commands = commands .split ()
5
+ if commands [0 ] == 'stop' :
6
+ break
7
+ elif commands [0 ] == 'push' :
8
+ lst .append (commands [1 ])
9
+ elif commands [0 ] == 'pop' :
10
+ index_of_value = lst .index (commands [1 ])
11
+ lst .pop (index_of_value )
12
+ else :
13
+ print ('invalid command' )
14
+
15
+ print (lst )
You can’t perform that action at this time.
0 commit comments