# Write Python code that assigns to the 
# variable url a string that is the value 
# of the first URL that appears in a link 
# tag in the string page.
# Your code should print http://udacity.com
# Make sure that if page were changed to

# page = '<a href="http://udacity.com">Hello world</a>'

# that your code still assigns the same value to the variable 'url', 
# and therefore still prints the same thing.

# page = contents of a web page

page =('<div id="top_bin"><div id="top_content" class="width960">'
'<div class="udacity float-left"><a href="http://udacity.com">')

start_link = page.find("<a href=")

#print (start_link) # output was 89
#link_string =page[89:118]
#print (link_string)
link_string =page[start_link:start_link+29]
print (link_string)
start_url=link_string.find('"')
#print (start_url)
end_url=link_string.find('"',9)
#print (end_url)
url=link_string[start_url+1:end_url]
print (url)

