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

ISI Programming Course - 04 - Python

Jungwon Seo
October 01, 2018

ISI Programming Course - 04 - Python

Jungwon Seo

October 01, 2018
Tweet

More Decks by Jungwon Seo

Other Decks in Technology

Transcript

  1. Python • This is very easy language. • We don’t

    have time to struggle to learn a programming language, not programming.
  2. Things to learn • Basic syntax • Data type •

    File read & write • Using web API • Web crawling
  3. Basic syntax • No semicolon; • ‘Tab’ based indentation •

    ‘=‘ means assign not equal. ‘==‘ means equal • ‘!=‘ means different, but ‘not’ can be used.
  4. Variable: Number • integer : -1,0,1,2,3 • float : 0.1,

    -0.43 • +, -, *, / • ** Source Code
  5. Variable: List • A collection type in Python • Literally,

    the list of element • use bracket : [ ] • Accessible by index • Guarantees the sequence of the element Source Code
  6. Variable: Dictionary • A collection type in Python • key

    - value structure • Unique key • Accessible by key • Doesn’t guarantee the sequence of the key Source Code
  7. Variable: Tuple • Pretty much like list • But you

    can’t update the element. Source Code
  8. Condition statement • IF - ELIF - ELSE • Inline

    if-else • value = 3 if a>b else 5 Source Code
  9. Class • It is really important, but one of the

    moment that students stop learning programming. • So let’s try this later
  10. Normal text • Need to use ‘open’ function • You

    have to open the file for both reading and writing • Don’t forget to close! Source Code
  11. JSON • The most popular format to store the data.

    • All programming languages easily support this format. • You can keep the complex data structure. Source Code
  12. API • In the web development, normally means REST-API. •

    Many companies serve their API to developers like us. • In general, the data format is JSON • You can find many useful APIs from the link below • https://market.mashape.com/explore?sort=developers
  13. Web Crawler • You need to collect some data. •

    No company opened their API for your data. • But you can check from the web browser. • I am not sure if it’s legal.
  14. Beautiful Soup • The way to get the data is

    simple. • Use request function in Python • The problem is when the response is HTML format. • Beautiful Soup will help you to parse the data. Source Code