Well I want to return an updated dictionary dependent on if else conditional statement through a function. But every time It returns null value instead of updated value. I wanted to update dictionary and return it on single line. Why the update function assign null value instead of updated values
def to_json(condition=True):
ls = ["abc", "xyz", "123"]
dis = {
"id": 123,
"value": "1122"
}
if condition is False:
return dis
else:
return dis.update({"Key": ls})
print(to_json())
output: None
instead of: {'id': 123, 'value': '1122', 'Key': ['abc', 'xyz', '123']}