I have a function that asks for the person their first and last name and then prints their age but i am having trouble entering the if statement, it is always skipping it.
My dictionary prints like this on the command line: {('name','subname'):19)}
l_name = raw_input("Enter last name")
f_name = raw_input("Enter first name")
if (l_name, f_name) in my_dict.items():
age = my_dict[l_name,f_name]
print age
thanks in advance
Try this:
if (l_name, f_name) in my_dict:
See it working online: ideone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With