This is a question about the Python parking fee calculation program.

Asked 2 years ago, Updated 2 years ago, 67 views

answer = {'1234': {'IN': '07:30',
                   'OUT': '15:15',
                   'parking_duration': 465,
                   'parking_fee': 24000},
          '2580': {'IN': '07:35',
                   'OUT': '08:45',
                   'parking_duration': 70,
                   'parking_fee': 4000},
          '0328': {'IN': '08:15',
                   'OUT': '21:00',
                   'parking_duration': 765,
                   'parking_fee': 39000},
          '9876': {'IN': '08:55',
                   'OUT': '23:45',
                   'parking_duration': 890,
                   'parking_fee': 40000},
          '1597': {'IN': '11:00'}}

The answer is this. I have a question in the coding process. I'm asking if the dictionary can be included in the dictionary again. I'm asking because I can't find a way no matter how much I look for it.

python dictionary

2022-09-20 10:52

1 Answers

There's Dick on the list and there's a list on the list.

a = {}
a[1] = {}
a[1][2] = 1
print(a)
b = []
b.append(a)
print(b)
a[2] = b
print(a)


2022-09-20 10:52

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.