I am trying to understand in operator's usage in Python.
Is there any difference between the following cases?
Case 1:
a = "Hello"
b = "Help"
b[0] in {a[0]} #case1
>> True
Case 2:
a = "Hello"
b = "Help"
b[0] in a[0] #case2
>> True
Though the outputs are same, I wanted to understand the difference between these two.
The first one is a set object with the first letter of
ain it, plus the period. It is a sequence type thatincan operate on.The second is a string with a single character in it. It is also a sequence type and the
inoperator can operate on it as well. The second one has no period in it.