Answer:
you are doing 1 string so you don't need all of the loops you had. string 2 is already char you don't need to change anything about it. you only need 1 loop.
def count_occurrences(string1, string2):
count = 0
for char in string1:
if char is string2:
count = count + 1
return count
first_str = input("Enter the first string:")
second_str = input("Enter the second string (one character long) : ")
occurrence = count_occurrences(first_str, second_str)
print(second_str + " occurs " + str(occurrence) + " time in " + first_str)