ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Interesting Python features (?)
    카테고리 없음 2017. 5. 2. 11:26

    While I was studying "Problem Solving with Algorithms and Data Structures using Python", I found some interesting features (or syntax) while studying chapter 1.


    1. It has "elif"

    You might have found you want several "else if" statements. Python helps you by shortening it to "elif".

    Please check https://docs.python.org/3/tutorial/controlflow.html


    2. Your fraction may be different from other Python version.

    While I was testing Listing 1 on 1.12 section, I tested squareroot() function with 4563 and found that the answer on my machine is 67.54998149518622!

    My machine is OSX with Python 3.6.0.


    3. There's no '++' for increment

    If you're familiar with other programming language, using '++' or '--' is so natural but Python doesn't have it. Best bet is using '+=1' instead.

    Please check http://stackoverflow.com/questions/1485841/behaviour-of-increment-and-decrement-operators-in-python




    댓글

Designed by Tistory.