Giter Site home page Giter Site logo

decode-pyramid's Introduction

decode-pyramid

Repository for a function designed to decode a message encoded within a text file.

Requirements

  1. Create a function called decode(message_file)
  2. decode(message_file) should have the following functionality:
    • read an encoded message from a .txt file
    • decode encoded message
    • return the decoded version as STR

Assumptions

The encoded message will be in the following format:

  • 3 love
  • 6 computers
  • 2 dogs
  • 4 cats
  • 1 I
  • 5 you

Functionality

  1. Read the file

    • functions: open()
    • methods: readlines()
  2. Decode the message

    • Separate each number from the associated word.
      • functions:
      • methods: split(), strip()
    • Order all numbers from smallest to biggest. Arrange them like a pyramid, where each line +1 than previous line.
      • functions:
      • methods: append()
    • For example, the numbers above would be arranged like this:
      • 1
      • 2 3
      • 4 5 6
    • Take the number at the end of each line (1, 3, 6) and use it to find the corresponding word in the message.
  3. Return the decoded message as a string "I love computers"

    • funtions:
    • methods: join()

decode-pyramid's People

Contributors

bit-bangin 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.