my code is like this
def quote():
complete_url = 'https://type.fit/api/quotes'
req = requests.get(complete_url)
response= req.json()
raw = []
quote = []
for i in range (len(response)):
raw.append(response[i]['author'])
unique_list = list(set(raw))
author = random.choice(unique_list)
search = input("what are you thinking about")
for i in range (len(response)):
for key, value in response[i].items():
if str(search) in str(value):
quote.append(value)
a=len(quote)
print(quote[randrange(a)])
feedback = input('Do you like this(Y/N)')
and I tried to create a notepad to remember behavior of the users to read so that the software can know what to prioritize the next time by:
opening = open("learning.txt", "r")
behavior = []
for x in opening:
#print(x)
behavior.append(x[:-1]) if x[-1] == "\n" else behavior.append(x)
learn = list(set(behavior))
function_name = learn[1]
Because the variables have not been defined already, or the dynamic variables, so I cannot use getattr or locals() and globals() as like this link:[https://stackoverflow.com/questions/3061/calling-a-function-of-a-module-by-using-its-name-a-string][1]
So, how can I call the function?