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

ツールとしてのプログラミング

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for Takuma Masuda Takuma Masuda
March 08, 2021
23

 ツールとしてのプログラミング

社内勉強会用に作成したスライドです。プログラミングの初歩の初歩です。

Avatar for Takuma Masuda

Takuma Masuda

March 08, 2021

Transcript

  1. Why Programming? In short, both are okay: nothing but a

    tool. VS But sometimes, it is better to use programming than Excel.
  2. Programming over Excel You can do more things. 1 You

    can process data much faster. 3 Web You can have an access to resources on Web. 2
  3. Variables You can put in variables numbers, strings and so

    on x = 1 # xʹ1Λ୅ೖ print(x) # ग़ྗɿ1 my_str = ‘Hello, world!’ print(my_str) # ग़ྗɿHello, world!
  4. Calculation You can calculate something with variables. x = 1

    + 2 # 3 y = 3 + x # 6 str_head = ‘Hello, ’ your_name = ‘Takuma’ str_tail = ‘!’ my_str = str_head + your_name + str_tail
  5. if if Execute different processing according to the given condition.

    x = 1 + 2 # 3 y = 3 + x # 6 str_head = ‘Hello, ’ your_name = ‘Takuma’ str_tail = ‘!’ my_str = str_head + your_name + str_tail x = 1 if x == 1: print(‘x is 1’) else: print(‘x is not 1’)
  6. for for Execute the same processing many times. x =

    1 + 2 # 3 y = 3 + x # 6 str_head = ‘Hello, ’ your_name = ‘Takuma’ str_tail = ‘!’ my_str = str_head + your_name + str_tail N = 3 for i in range(N): print(i) # ग़ྗɿ0, 1, 2
  7. List You can put objects like numbers and strings in

    a list. x = 1 + 2 # 3 y = 3 + x # 6 str_head = ‘Hello, ’ your_name = ‘Takuma’ str_tail = ‘!’ my_str = str_head + your_name + str_tail list = [1, 8, 5, 4] for i in range(4): print(list[i])
 # ग़ྗ: 1, 8, 5, 4
  8. Function You can reuse the same processing with functions. x

    = 1 + 2 # 3 y = 3 + x # 6 str_head = ‘Hello, ’ your_name = ‘Takuma’ str_tail = ‘!’ my_str = str_head + your_name + str_tail def incr_two(x): return x + 2 y = 4 ans = incr_two(y) print(ans) # ग़ྗ 6
  9. Let’s build it! You are given a list of clients.

    1 Finish the quest by filling up the blanks. 3 Web You wanna guess each link to the companies’ web. 2