+ 1
I think it's better To determine whether a key is in a dictionary
Example: nums = { 1: "one", 2: "two", 3: "three", } print(1 in nums) print("three" in nums) print(4 not in nums) >>>true >>>false >>>true But we can write: nums = { 1: "one", 2: "two", 3: "three", } print(1 in nums.keyworld) print("three" in nums) print(4 not in nums.keyword) And now: >>>true >>>true >>>true If I were a Python developer I would have added this section to the language.
4 Respuestas
+ 1
u can also try this:
print(nums. get(4,"not in nums"))
0
Oh,I got it
I didn't know there is an other way To determine whether a key is in a dictionary
0
This is a good way to check and print our text.
It can check all the characters
Thanks a lot💐💐💐👌👍👍👍