I have my dictionary iterating over my integer array the way I want and get my desired result with print but only get the first iteration when I use a return
statement
for i in range(0, N):
new_dic.update({i:Vk_s[i]})
print(new_dic)
out:
{0: 0}
{0: 0, 1: 0}
{0: 0, 1: 0, 2: 0}
{0: 0, 1: 0, 2: 0, 3: 4}
{0: 0, 1: 0, 2: 0, 3: 4, 4: 5}
{0: 0, 1: 0, 2: 0, 3: 4, 4: 5, 5: 6}
vs
for i in range(0, N):
new_dic.update({i:Vk_s[i]})
return(new_dic)
print(new_dic)
out:
{0: 0}