0

Can you use not instead of != ?

In Python

15th Aug 2023, 8:14 AM
Muhammad Hassan Abbas
Muhammad Hassan Abbas - avatar
3 odpowiedzi
+ 5
It depends on the circumstance. `!=` is better for comparing values whilst `is not` is better for comparing object locations. Check this out for more details: https://www.tutorialspoint.com/difference-between-and-is-not-operator-in-JUMP_LINK__&&__python__&&__JUMP_LINK
15th Aug 2023, 8:21 AM
Justice
Justice - avatar
+ 4
Fun zone , maybe you can share your code or a snippet as sample for us?
15th Aug 2023, 2:43 PM
Lothar
Lothar - avatar
+ 1
Нет, нельзя использовать not вместо != , его нужно использовать для boolean значений, допустим, not True(False) not False(True) .
15th Aug 2023, 8:44 PM
Programmer I = "Junior";