Coder Social home page Coder Social logo

flight-search's Introduction

Python weekend entry task solution

Python script for search flights between airports A -> B from raw CSV flights data including meaningful layover options

Task description is here

How to run

Just clone and run:

python solution.py csv-data-examples/example1.csv DHE NRX --bags=1 --return

This request will perform a search for flights from airport DHE -> NRX and back NRX -> DHE for flights which allow at least 1 piece of baggage.

To get a more readable and compact output into a console instead of JSON format, add --console parameter:

python solution.py csv-data-examples/example2.csv GXV YOT --console

This request will find flights GXV -> YOT and print results into a console

Required positional arguments

Argument name type Description
datafile string Path to SCV file with flights data
origin string Source airport code
destination string Destination airport code

Optional arguments

Argument name type Description Notes
bags integer Number of requested bags Optional (default is 0)
return boolean Is it a return flight? Optional (default is false)
console boolean Output into a console Optional (default is false)

Search restrictions

  • In case of a combination of A -> B -> C, the layover time in B will be not less than 1 hour and more than 6 hours.
  • No repeating airports in the same trip.
    • A -> B -> A -> C is not a valid combination for search A -> C.
  • Output is sorted by the final price of the trip.

Approach

Python 3.10, only standard library used, no 3rd party packages Graph, deep first search

flight-search's People

Contributors

r-ss 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.