There are three interdependent tasks in this challenge, complete ALL. The submission instructions are specified at the bottom of the challenge page.
Write a program that prints exactly 1000 lines of text to standard output. Each line of text is a date in the form dd/MM/YYYY, where:
- valid ranges for days are 00-30
- valid ranges for months are 1-12
- valid ranges for years are 2017-2018 The lines of text are to be generated randomly - that is, there should be a reasonably arbitrary distribution of logs from all possible dates.
Write a program that reads lines of test from standard input. The program should process each line and:
- Print "Malformed input" and exit, if the line is not in the form dd/MM/YYYY
- Count lines from each month that appears in a line. The program should not count months that do not appear in any line.
- Print lines from 0-14th of 2018.
Finally, the program should print each logged month with the percentage of lines of text from that month in the form:
Month: XX%
Where "Month" refers to the name of that month.
For example:
May: 35%
-
Check out the format for submitting your code here
-
Make sure when creating a branch to use your correct phone Number, as this is what we will use to get back to you.
NB: As a branch-name you can also use your email. See you on the other side, and best of luck!
In case you have any questions, join our Slack here and join the #internship-challenge channel.
Please read the overview here.