Giter Site home page Giter Site logo

Comments (2)

likejazz avatar likejazz commented on June 27, 2024 2

가독성을 높이기 위해 쓰는 기법입니다.

예를 들어 5부터 10까지 합을 구한다고 할때,

# 1)
for n in range(5, 11):
    sums += n

# 2)
for n in range(5, 10 + 1):
    sums += n

1)번처럼 만 해도 충분하지만 이 경우 11만 봐서는 10을 언뜻 떠올리기가 쉽지 않습니다. 반면 2)에서는 10 + 1로 처리하여 10까지 진행한다는 명확한 의도를 코드에 표현했습니다. 이 처럼 가독성을 높이는 기법을 책에서는 곳곳에 활용하였고, 코딩 인터뷰 시에도 이 같은 내용을 설명할 수 있다면 훨씬 더 좋은 평가를 받을 수 있겠습니다. 다만, 이런 부분을 책에 직접적으로 설명하지 않은건 제가 놓친 부분 같네요. 추후 개정판에는 설명을 보완할 수 있도록 하겠습니다.

from python-algorithm-interview.

ksundong avatar ksundong commented on June 27, 2024

@likejazz
아하 이해가 됐습니다. 가독성을 높이기 위한 기법이었군요.
감사합니다. ^^

from python-algorithm-interview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.