Right to the point, here below is the sample code which will raise error in PyCharm:
list1 = [0] * 5
list1[0] = ''
list2 = [0 for n in range(5)]
list2[0] = ''
PyCharm then return an error on both line 2 and line 4 as below:
Unexpected type(s):(int, str)Possible type(s):(SupportsIndex, int)(slice, Iterable[int])
Running the code would not cause any error, but PyCharm keep raising the above message when I am coding. I wonder why PyCharm would give this error and how can I solve this with cleanest code. Thanks.
Edit: Sorry here was a typo in line 3 of the sample code which has been corrected.(list2 = [0 for n in range(0)] should be list2 = [0 for n in range(5)])