Upgrade to Pro — share decks privately, control downloads, hide ads and more …

弄蛇人的程式語言入門

 弄蛇人的程式語言入門

2014/07/15 Workshop @ SITCON Summer Camp 2014, National Chengchi University, Taipei, Taiwan

Poren Chiang

July 15, 2014
Tweet

More Decks by Poren Chiang

Other Decks in Technology

Transcript

  1. ߐ㡦࿝ዅ RSChiang • 112 ᝖୪㋁ • SITCON / COSCUP ⵈⶦ೸

    • Python ჿࢼ␹ • You can reach me at http://poren.tw
  2. Beautiful is better than ugly. Explicit is better than implicit.

    Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts.
  3. #include <iostream> using namespace std; ! int main(int argc, char*

    argv) { cout << “Hi SITCON!”; return 0; } print(“Hi SITCON!”) C++ Python
  4. string a = “ݙ”;
 string b = “”; for (int

    i = 1; i <= 5; i++) { b += a; } cout << b; print(“ݙ” * 5) C++ Python
  5. for (int i = 1; i <= 5; i++) {

    cout << “#” << i << “\n”; } for i in range(5): print(“#” + str(i)) C++ Python
  6. speakers = [‘Allen’, ‘Bob’, ‘RS’, ‘⒀㐷’] for i, speaker in

    enumerate(speakers): print(‘#{0} - {1}’.format(i, speaker)) print(len(captains))
  7. reduce( lambda a, b: a or b, [ x %

    i == 0 for i in range( 2, int(x ** 0.5 + 1) ) ] )