Screen Link: https://app.dataquest.io/m/315/functions%3A-fundamentals/9/reusability-and-multiple-parameters
Functions: Fundamentals Screen 9 has the below code where two functions with same name have been used.
def freq_table(index):
frequency_table = {}
for row in apps_data[1:]:
value = row[index]
if value in frequency_table:
frequency_table[value] += 1
else:
frequency_table[value] = 1
return frequency_table
# UPDATED FUNCTION
def freq_table(data_set, index):
frequency_table = {}
for row in data_set[1:]:
value = row[index]
if value in frequency_table:
frequency_table[value] += 1
else:
frequency_table[value] = 1
return frequency_table
My question is how does python know which function is to be executed in such cases. Is this done basis the parameters entered?