+ 1
This same as previous code
Why dictionary.has_key() method does not run well and not give expected result? https://sololearn.com/compiler-playground/cH5WKjYqBKOI/?ref=app
4 odpowiedzi
+ 6
has_key have been deprecated in Python 3.x
use key in dict instead
print('A' in Dictionary1)
print('For' in Dictionary1 )
+ 2
Python language has been around for a very long time, and there is significant difference between version 2 and 3 even in terms of syntax.
Python 2 is no longer officially supported, and many old tutorials on the web are not updated. You should try to look for fresh material to learn from, and seek out the latest version and most recent features of Python. Eventually those will be used everywhere. Some newer things like walrus operator, dataclass, async library, pattern matching - are very useful and important, and frequently applied in modern Python code bases, but not covered even in the Sololearn courses.
0
Thank you for your information that has_kay() has been deprecated. But many python can run this code. I don't understand. Thank you Tibor Santa.
0
probably because there's still people clinging to Python 2.x