19
hamukazu
6 21 26
1911/ 2195
加藤公一(はむかず)
Last seen 7 years ago
Member for 10 years, 3 months, 6 days
Difficulty Normal
Best reviews / Newest reviews
First-junjiru 1 1
1) Triangular number can be easily got as i*(i+1)//2 for i=1,2,... sample code: [i*(i+1)//2 for i in range(n)] 2) Sorting in python is easy. Just use sorted() 3( You don't need temporary variable to swap the value. Use a,b=b,a for example. More
First-tanakh
It7s convenient to use the parameter "key" of the function "sorted." It specifies how it is sorted, not affecting the resulting list. More
First-tanakh
The module "itertools" has "combinations" and "permutations" http://docs.python.org/2/library/itertools.html More
First-junjiru
the "replace" method of string class is convenient. Try "abc def gh".replace(" ","") for example. More