This is my code:
tempStorage = 'GOOD.LUCK'
print(tempStorage.find("."))
Instead of outputting 1, it outputs 4. Can someone tell me why?
Edit – I’m stupid, I confused count() with find()
>Solution :
You’re using str.find() which tells you the position.
You should use str.count() instead which counts the number of occurrences.
tempStorage = 'GOOD.LUCK'
print(tempStorage.count("."))
>>> 1