Feb-05-2020, 05:03 PM
I'm working with a dictionary (full of dictionaries, I believe?).
Here it is:
One which will take this dictionary as input, and return the 'body' value for the last line in the dictionary that was input. Please note that this dictionary is dynamic, in that the last line will be different each time the function runs.
(In this instance, it should return 'testing sms ID)
The next function should be able to take a key as input (one of the numbers on the left) and return the corresponding 'body' value.
{for example, input 5333257 should return take 2!
Thank you
Here it is:
{1005672: {4461048: {'body': 'Mnow test test', 'msg_id': 4461048}, 4620511: {'body': 'test sms,test sms', 'msg_id': 4620511}, 4620584: {'body': 'test sms', 'msg_id': 4620584}, 4646648: {'body': 'test sms', 'msg_id': 4646648}, 4646877: {'body': 'test sms', 'msg_id': 4646877}, 4671891: {'body': 'test sms', 'msg_id': 4671891}, 4697824: {'body': 'test sms', 'msg_id': 4697824}, 4700841: {'body': 'test sms', 'msg_id': 4700841}, 5149461: {'body': 'Is it?', 'msg_id': 5149461}, 5159744: {'body': 'end of day test', 'msg_id': 5159744}, 5159829: {'body': 'trying again and again', 'msg_id': 5159829}, 5327356: {'body': 'test for convo id', 'msg_id': 5327356}, 5327606: {'body': 'eventually this will work!', 'msg_id': 5327606}, 5327619: {'body': 'this will work i say!', 'msg_id': 5327619}, 5327736: {'body': 'testing again\r\n', 'msg_id': 5327736}, 5332767: {'body': 'testing testing 1..2...3...', 'msg_id': 5332767}, 5333204: {'body': 'testing the convID part...', 'msg_id': 5333204}, 5333257: {'body': 'take 2!', 'msg_id': 5333257}, 5333489: {'body': 'aaaaaaaaaaaand ACTION!', 'msg_id': 5333489}, 5337141: {'body': 'does it work?', 'msg_id': 5337141}, 5363443: {'body': 'Test', 'msg_id': 5363443}, 5365638: {'body': 'testing again', 'msg_id': 5365638}, 5366005: {'body': 'testing sms ID', 'msg_id': 5366005}}}I need to write 2 functions:
One which will take this dictionary as input, and return the 'body' value for the last line in the dictionary that was input. Please note that this dictionary is dynamic, in that the last line will be different each time the function runs.
(In this instance, it should return 'testing sms ID)
The next function should be able to take a key as input (one of the numbers on the left) and return the corresponding 'body' value.
{for example, input 5333257 should return take 2!
Thank you