python – Go to the wiki page "philosophy"

Is my code correct?

import requests
import bs4
import time
import urllib.request

def input_link ():

start_url = "https://en.wikipedia.org/wiki/Special:Random"
response = requests.get (start_url)
html = response.text
soup = bs4.BeautifulSoup (html, "html.parser")
return the soup

def right_link (soup):

for the element in soup.find_all ("p"):
if element.find ("a"):
article_link = element.find ("a"). get (& # 39; href & # 39;)
link = "http://en.wikipedia.org" + article_link
return link

def loop (link):

for element in the range (50):
response = requests.get (link)
html = response.text
soup = bs4.BeautifulSoup (html, "html.parser")
for the element in soup.find_all ("p"):
if element.find ("a"):
link = element.find ("a"). get (& # 39; href & # 39;)

return ("http://en.wikipedia.org" + link)

def continue_crawl (link):

target_url = "https://en.wikipedia.org/wiki/Philosophy"
if link == target_url:
print ("We found the target article!")
elif len (link)> 50:
print ("The search lasted suspiciously long, the search was canceled!")
link elif == link:
print ("We have arrived at an article we have already seen, an aborted search!")

def ():

for i in the range (10):
x = input_link ()
y = right_link (x)
z = loop (y)
a = continue_crawl (z)
time.sleep (2) # slows down otherwise the wiki server will block you

main ()