@@ -73,8 +73,30 @@ for i in sorted(set(s)):
7373 print (f ' { i} ,  { s.count(i)} ' )
7474``` 
7575--- 
76+ ``` python  
77+ ''' Solution by: popomaticbubble
78+ ''' 
79+ def  character_counter (text ):
80+ characters_list =  list (text)
81+ char_count =  {}
82+ for  x in  characters_list:
83+ if  x in  char_count.keys():
84+ char_count[x] +=  1 
85+ else :
86+ char_count[x] =  1 
87+ return  char_count
88+ 
89+ 
90+ def  dict_viewer (dictionary ):
91+ for  x, y in  dictionary.items():
92+ print (f " { x} , { y} " )
7693
7794
95+ text =  input (" > "  )
96+ dict_viewer(character_counter(text))
97+ ``` 
98+ --- 
99+ 
78100# Question 91  
79101
80102### ** Question**  
@@ -197,7 +219,21 @@ print(ns)
197219import  itertools
198220print  list (itertools.permutations([1 ,2 ,3 ]))
199221``` 
222+ --- 
223+ ``` python 
224+ """ Solution by: popomaticbubble
225+ """ 
226+ from  itertools import  permutations
227+ 
228+ def  permuation_generator (iterable ):
229+  p =  permutations(iterable)
230+  for  i in  p:
231+  print (i)
200232
233+ 
234+ x =  [1 ,2 ,3 ]
235+ permuation_generator(x)
236+ ``` 
201237--- 
202238
203239# Question 94  
@@ -226,12 +262,40 @@ def solve(numheads,numlegs):
226262 return  i,j
227263 return  ns,ns
228264
229- numheads= 35 
230- numlegs= 94 
265+ numheads  =   35 
266+ numlegs  =   94 
231267solutions= solve(numheads,numlegs)
232268print  solutions
233269``` 
270+ --- 
271+ ``` python 
272+ """ Solution by: popomaticbubble
273+ """ 
274+ import  itertools
234275
276+ def  animal_counter (lst ):
277+  chickens =  0 
278+  rabbits =  0 
279+  for  i in  lst:
280+  if  i ==  2 :
281+  chickens +=  1 
282+  elif  i ==  4 :
283+  rabbits +=  1 
284+  print (f " Number of chickens is  { chickens} \n Number of rabbits is  { rabbits} " )
285+ 
286+ 
287+ def  animal_calculator (total_legs , total_heads , legs_of_each_species ):
288+  combinations =  itertools.combinations_with_replacement(legs_of_each_species, total_heads)
289+  correct_combos =  []
290+  for  i in  list (combinations):
291+  if  sum (i) ==  total_legs:
292+  correct_combos.append(i)
293+  print (correct_combos)
294+  for  i in  correct_combos:
295+  animal_counter(i)
296+ 
297+ animal_calculator(94 , 35 , legs_of_each_species = [2 ,4 ])
298+ ``` 
235299--- 
236300
237301[ ** _ go to previous day_ ** ] ( https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_21.md  " Day 21 ") 
0 commit comments