Exercise 1
Write a python program that given some messages stolen from a messaging app can extract
if the message contains some reference to a time.
It should take in a message from input()
and produce a python
datetime object that it then prints out.
There is no strict scope here on purpose, try to see if your program can handle anything
that you could see a person saying to refer to a time.
Below are only some examples. Obviously if you can't deduce all the info from the
message you have to make suitable assumptions. i.e If you just say Friday assume
it means the coming friday.
Assume the below code was run Feb 7th 2019 at 8:41
> now
2019-02-07 08:41:56.153172
> yesterday
2019-02-06 00:00:00.000000
> jan 5th
2019-01-05 00:00:00.000000
> January 5th
2019-01-05 00:00:00.000000
> Feb 5th 2018
2018-02-05 00:00:00.000000
> 2018 5th of Jan
2018-01-05 00:00:00.000000
> next friday
2019-02-09 00:00:00.000000
> last wednesday
2019-02-06 00:00:00.000000
> friday 5th of janurary 5pm
2018-01-05 17:00:00.000000
> friday 5th of janurary 15:00
2018-01-05 17:00:00.000000
> yo homie lets met up at 9am
2019-02-07 09:00:00.000000
Exercise 2
Write a python class with at least 1 function called talk
which
given a slack message will return a response.
If your class has no response return None
You can code up this class to do whatever
but it should be able to print the current weather.
Just make sure that if your bot has a trigger phrase so what's the weather
does nothing but hey weatherbot, what's the weather
returns a response.
Below is a example
> now
> weather bot, what's the weather tomorrow
it will be 23 degrees tomorrow in sydney
> weather bot, what's the weather tomorrow in chiagao
it will be -10 degrees tomorrow in chiago
...