Giter VIP home page Giter VIP logo

look_and_say_sequence's Introduction

파이썬으로 개미수열 구하기

베르나르 베르베르의 소설 「개미」에 나온 수열로 개미 수열

문제 이해 및 분석

  • 문제에서 해결하고자 하는 것은?
    • 양의 정수 n이 주어질때 n번째 항(개미수열)의 자릿수 중 가운데 두 자리 수(m)을 출력한다.
    • (조건) 첫번째 항은 1이고, 입력 값 n은 3보다 크고 100보다 작음
  • 문제에서 규칙 찾기 : 이전 수열에서 연속적인 자연수의 개수를 파악하여 다음 수열을 만든다.

문제이해풀이과정

  1. 리스트를 이용하는 법
  • 리스트 형태로 저장, 파악한 규칙을 적용
  • 현재 알고 있는 개미 수열을 ant 저장 / 다음 개미 수열을 newant 저장
  • ant에 list의 첫번째 원소를 target에 저장
  • list안에 int를 -> str로 변경
  • m 값 출력하는것
  • 인덱싱 슬라이싱을 이용하여 출력 했다.

testcode

  1. LASS.py -> 개미수열을 구하는 코드 + unittest : testcode를 파일 하나에 작성
  2. ant_sequence_module.py -> 개미수열을 구하는 코드
  3. test_ant_sequence.py -> unittest : testcode : 파일을 나누어서 만듬

look_and_say_sequence's People

Contributors

ariel-ssen avatar

Watchers

 avatar

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.