Category : dictionary

I have a result like this: { "read":["English"], "speak":["English", "French", "Portuguese", "German"], "write":[], "fluency":{"English":"Advanced", "German":"Beginner"} } my data mapper: { language:{ speak:[], write:[], read:[], fluency:{} } } MY CODE: result = {} if ‘fluency’ in language.keys(): for k, v in language.get(‘fluency’, {}).items(): result[k] = {v: []} if k in language[‘speak’]: result[k][v].append(‘Speak’) if k in language[‘read’]: ..

Read more

I’m writing Python code on one of the new TI-84 Python edition calculators. These use a version of CircuitPython with limited support for some quite basic features. This includes missing dictionary methods such as items() and values(). My original version of Dijkstra’s Algorithm is below, followed by a nearly complete version in TI-Python. I’m having ..

Read more

I have this function, inputs are list of arguments and allowed arguments, it converts these args to dictionary for example x = ["-a", "Avatar link", "-u", "user name"] y = ["-u", "-a", "-id"] output = {"-a": "Avatar link", "-u": "user name"} def parseArgs(args:list, allowed_args:list): """Parse list of non-positional arguments and return a dictionary, inputs are ..

Read more

I have 2 Lists of dictionaries, example below: list one = [ {‘day’: ‘2021-09-05 00:00:00+02:00’, ‘airtime_total_for_day’: ‘650.00’, ‘data_total_for_day’: ‘0’}, {‘day’: ‘2021-09-16 00:00:00+02:00’, ‘airtime_total_for_day’: ‘124.20’, ‘data_total_for_day’: ‘20.00’}, ] list_two = [ {‘day’: ‘2021-09-10 00:00:00+02:00’, ‘data_bundle_total_for_day’: ‘100.00’}, {‘day’: ‘2021-09-16 00:00:00+02:00’, ‘data_bundle_total_for_day’: ‘50.00’}, {‘day’: ‘2021-09-18 00:00:00+02:00’, ‘data_bundle_total_for_day’: ‘45.00’}, ] I would like to merge the two lists together ..

Read more