Code Monkey home page Code Monkey logo

parsing-yaml's Introduction

Parsing YAML

The file files/335982.yaml has ball-by-ball summary of a cricket match. Produce the following simple version of match scorecard from it listing the following.

Question 1

Write a function that returns how many runs were scored by each batsman?

  • Define a function with name runs_scored which will accept integer parameter match_code.
  • According to match code find out batsmans and runs scored by them.
  • Store them inside pandas dataframe which should have columns
    • Batsmans
    • Team
    • Runs_Scored
  • match_code is nothing but name of yaml file. When you send match_code you should parse match_code.yaml file.
  • In this scenario pass match_code as 335982 which should parse 335982.yaml file stored in files directory.

Question 2

Write a function that returns how many balls were faced by each batsman?

  • Define a function with name balls_faced which will accept integer parameter match_code.
  • According to match code find out batsmans and balls faced by them.
  • Store them inside pandas dataframe which should have columns
    • Batsmans
    • Team
    • Balls_Faced
  • match_code is nothing but name of yaml file. When you send match_code you should parse match_code.yaml file.
  • In this scenario pass match_code as 335982 which should parse 335982.yaml file stored in files directory.

Question 3

Write a function that returns how many balls were balled by each bowler?

  • Define a function with name balls_bowled which will accept integer parameter match_code.
  • According to match code find out bowlers and balls bowled by them.
  • Store them inside pandas dataframe which should have columns
    • Bowler
    • Team
    • Balls_Bowled
  • match_code is nothing but name of yaml file. When you send match_code you should parse match_code.yaml file.
  • In this scenario pass match_code as 335982 which should parse 335982.yaml file stored in files directory.

Question 4

Write a function that returns how many runs were conceded by each bowler?

  • Define a function with name runs_conceded which will accept integer parameter match_code.
  • According to match code find out bowlers and runs conceded by them.
  • Store them inside pandas dataframe which should have columns
    • Bowler
    • Team
    • Runs_Conceded
  • match_code is nothing but name of yaml file. When you send match_code you should parse match_code.yaml file.
  • In this scenario pass match_code as 335982 which should parse 335982.yaml file stored in files directory.

Question 5

Write a function that returns name of the teams.

  • Define a function with name get_teams which will accept integer parameter match_code.
  • According to match code find out name of all teams.
  • Store them inside list which should have team names.
  • match_code is nothing but name of yaml file. When you send match_code you should parse match_code.yaml file.
  • In this scenario pass match_code as 335982 which should parse 335982.yaml file stored in files directory.

Question 6

Write a function that returns who batted first?

  • Define a function with name get_first_batsman which will accept integer parameter match_code.
  • According to match code find out name of the first batsman.
  • Return batsman name as string variable.
  • match_code is nothing but name of yaml file. When you send match_code you should parse match_code.yaml file.
  • In this scenario pass match_code as 335982 which should parse 335982.yaml file stored in files directory.

Question 7

Write a function that returns who won?

  • Define a function with name get_winner which will accept integer parameter match_code.
  • According to match code find out winner team of match.
  • Return team name as string variable.
  • match_code is nothing but name of yaml file. When you send match_code you should parse match_code.yaml file.
  • In this scenario pass match_code as 335982 which should parse 335982.yaml file stored in files directory.

parsing-yaml's People

Contributors

sangamangreg avatar shwedosh avatar

Watchers

James Cloos 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.