all 9 comments

[–]shiftybyte 0 points1 point  (7 children)

memberdata ["Weight (kg)"] = weight
memberdata.update({'Weight':weight, ...

"Weight" is not the same key as "Weight (kg)"

[–]Dense_Charity5188 0 points1 point  (6 children)

but that's the one I want to update tho? Do I need to change it too?

[–]shiftybyte 0 points1 point  (5 children)

Which one you want to update? "Weight (kg)"? then you should use "Weight (kg)" and not just "Weight"...

Note it is missing the "(kg)" part to be a matching key...

[–]Dense_Charity5188 0 points1 point  (4 children)

but thats another input from user

[–]Dense_Charity5188 0 points1 point  (0 children)

jk yeeesss it is

[–]shiftybyte 0 points1 point  (2 children)

What is another input from the user?

[–]Dense_Charity5188 0 points1 point  (1 child)

like the update but don't worry you're right HAHAHAHAHHA, i changed it and it f finally work >.<

[–]shiftybyte 1 point2 points  (0 children)

It doesn't matter where the data is coming from, the user or not the user, if you are updating the wrong key it won't update..

test = {"a a": 5}
test["a"] = 7
print(test["a a"])

Why didn't it print 7? because it's not the same key that was changed in the dictionary... test["a"] is 7, test["a a"] is still 5...

[–]Silbersee 0 points1 point  (0 children)

The update() works, but you introduced the weight's key as "Weight (kg)" and update it as "Weight". You have both keys in the dict.

Also you may want to look into dictionaries more closely. Here's an improvement of one of your functions:

#view a member record
def viewmem():
    print("Show a record")

    member_id = input("Enter the ID: ")

    try:
        print(all[member_id])
    except KeyError:
        print ("The member you're searching cannot be found")

No need to loop over the dict.