my_module.py
print('Module Imported...')
test = 'Test String'
def find_index(to_search, target):
'''Find the index of a value in a sequence'''
for i, value in enumerate(to_search):
if value == target:
return i
return 'none'
intro.py
from my_module import find_index
courses = ['Math', 'Arts', 'History', 'English']
index = find_index(courses, "History")
print(index)
When running this the result is:
Module Imported...
2
I want to know why is my program printing the 'Module Imported...' string even though I am only importing the find_index function.