list - Capitalization of all characters string in a double loop in Python -


I have the following Python code, it caps the circle through each string and capitalizes each letter: < RL = List (STR) = L cap_char [i] .capitalize () RL [i] in the range (lane (l)) in the range for pre> str = 'abcd' l = list (STR) i. = Cap_char str1 = ''. (RL) joining the print str1

Which creates:

Abcd ABCD ABCD ABCD < P> I would like this code to increase the number of mutant characters until it reaches capitalization until it reaches the lane (L) -1 to generate this number:

 < Code> ABCD ABCD ABCD ABCD & gt; & Gt; - 1 Charged Capitalized ABCD ABCD ABCD ABCD & gt; & Gt; - ABCD ABCD ADCD & gt; - When I make indexes arithmetic, then understand that the idea should be wrapped, but can not generate an elegant code (<< code>   

/ p>

After the text

  import itertools x = 'abcd' n = lane (x) for xrange (1, n): combination = Itertools.combinations (Range (n), i) For the combination in c: print '' .join ([k] m for the meter in the calculation of k.upper (in c), k (x)], Print 'gt; & gt; - four (s) capitaliz Output:  
  Abcd ABCD ABCD ABCD> - 1 character (s) Capitalized ABCD ABCD ABCD ABCD ABCD & gt; & gt; - 2 Capitalized ABCD ABCD ABCD & gt; & gt; - 3 Capitalized Capitalized    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -