Complete the function/method so that it returns the url with anything after the anchor (`#`) removed. 

## Examples

```python
# returns 'www.codewars.com'
remove_url_anchor('www.codewars.com#about')

# returns 'www.codewars.com?page=1' 
remove_url_anchor('www.codewars.com?page=1') 
```

Difficulty: introductory

Starter code:

def remove_url_anchor(url):
	

Solutions:
def remove_url_anchor(url):
  return url.split('#')[0]

def remove_url_anchor(url):
  return url.partition('#')[0]

def remove_url_anchor(url):
  import re
  return re.sub('#.*$','',url)

def remove_url_anchor(url):
    index = url.find('#')
    return url[:index] if index >= 0 else url

def remove_url_anchor(url):
  return url[:url.index('#')] if '#' in url else url

def remove_url_anchor(url):
  try:
    return url[:url.index('#')]
  except:
    return url

def remove_url_anchor(url):
    pos = 0
    for i in url:
        if i == '#':
            break
        pos += 1
    # print(url[:pos])
    return url[:pos]


from urllib.parse import urldefrag
def remove_url_anchor(url):
    return urldefrag(url).url


import re

def remove_url_anchor(url):
    fn = re.search(r"[^#]+", url)
    return fn.group(0)


from itertools import takewhile

def remove_url_anchor(url):
    return ''.join(takewhile(lambda l: l != '#', url))

import re
def remove_url_anchor(url):
    match = re.search(r'[a-zA-Z0-9.?/=:]+', url)
    return match.group()

import re
def remove_url_anchor(url):
    return re.sub("#[a-zA-Z0-9]+$", "", url)

import re

def remove_url_anchor(url):
    anchor = url.find('#')
    return url[:anchor] if anchor != -1 else url

def remove_url_anchor(url):
    return url[:url.find('#')] if url.find('#') != -1 else url

remove_url_anchor = lambda url: url.split('#')[0]

remove_url_anchor = lambda s: __import__('re').sub('(.*)\\#.*', '\\1', s)

def remove_url_anchor(url):
    list=[]
    for x in url:
        a = list.append(x)
        if x == '#':
            break  
    y = ''.join(list).replace('#', '')
    return ( y )
    # TODO: complete


def remove_url_anchor(url):
    return url if url.count("#") == 0 else url[:url.index("#")]

def remove_url_anchor(url):
    new_url = ''
    for i in url:
        if i =="#":
            return new_url
        new_url += i
    return url

def remove_url_anchor(url):
    posicion =url.split("#")
    nuevo=posicion[0:1]
    return "".join(nuevo)

import re

def remove_url_anchor(url):
    pattern = re.compile(r'((http://?|https://?|http://www\.?|https://www\.?|www\.?|)+([a-zA-z0-9]+\.[a-zA-z0-9./-_]+))[^#]*')
    matches = pattern.finditer(url)
    for match in matches:
        return(match.group(1))

import re
def remove_url_anchor(url):
    return re.search(r'^(.*?)(#|$)',url).group(1)

def remove_url_anchor(url):
    if '#' in url: 
        return ''.join(list(url)[:list(url).index('#')]) 
    else:
        return url
  # TODO: complete


def remove_url_anchor(url):
    res = ""
    for i in url:
        if i != "#":
            res += i
        else:
            return res
            break

    return res      

def remove_url_anchor(url):
    web=[]
    for letter in url:
        if letter=='#':
            break
        else:
            web.append(letter)
    return ''.join(web)


def remove_url_anchor(url):
    try:
        ret_url, non_url = url.split('#', 1)
        return ret_url
    except:
        return url


def remove_url_anchor(url):
    import re
    # TODO: complete
    new=re.split('#+',url)
    return new[0]

def remove_url_anchor(url):
    if '#' in url: i = url.index('#')
    else: return url
    return url[:i]


def remove_url_anchor(url):
    final_url = ''
    for i in url:
        if i == '#': 
            return final_url
        final_url += i
    return final_url

def remove_url_anchor(url):
    anchor_pos = url.find('#')
    return url[0: anchor_pos if anchor_pos > 0 else len(url)]

def remove_url_anchor(url):
    if "#" in url:
        anchorindex= url.index("#")
        return url[:anchorindex]
    else:
        return url

def remove_url_anchor(url):
    if not "#" in url: return url 
    return url[0:url.index("#")]

def remove_url_anchor(url):
    new_url_lst = []
    new_url = ''
    for i in url:
        if i != '#':
            new_url_lst.append(i)
        else:
            break
    return "".join(new_url_lst)


def remove_url_anchor(url):
    ret = ""
    wh = len(url)
    for i in url:
        if i == "#":
            wh = url.index(i)
            break
    for i in range(0, wh):
        ret += url[i]
    return ret

def remove_url_anchor(url):
    x = ""
    for i in url:
        if i == "#":
            break
        x += i
    return x

def remove_url_anchor(url):
    index = url.find("#")
    return url[:index if index > 0 else len(url)]

def remove_url_anchor(url):
    return url[:len(url) if url.find('#') == -1 else url.find('#')]

def remove_url_anchor(url):
    if not "#" in url : return url
    return url[:url.find('#')]

def remove_url_anchor(url):
    hash = url.find('#')
    if hash == -1:
        return url
    else:
        new_url = url[0:hash]
        return new_url

def remove_url_anchor(url):
    l = ''
    for n in url:
        if n == '#':
            break
        else:
            l += n
    return l

def remove_url_anchor(url):
    list = []
    for i in url:
        list.append(i)
        if i == '#':
            list.pop()
            break
    print(list)
    new_string = ''.join(list)
    print(new_string)
    return new_string

def remove_url_anchor(url):
    try:
        anchorIndex = url.index('#')
        return url[:anchorIndex]
    except:
        return url

def remove_url_anchor(url):
    url_new=""
    for i in url:
        if i == "#":
            return url_new
        url_new += i
    return url_new

def remove_url_anchor(url):
    # TODO: complete
    
    fixed_url = url.split("#")
    
    return fixed_url[0]

import re

def remove_url_anchor(arry):
    if '#' in arry:
        arry = re.match(r"^(.*)\#", arry).group(1)

    return arry

import re

def remove_url_anchor(url):
    regex = r'#\w+.+'
    subst = ''
    result = re.sub(regex, subst, url)
    return result

def remove_url_anchor(url):
    return url[0:url.find("#")] if "#" in url else url


def remove_url_anchor(url):
    url_list = list(url) 
    if '#' in url_list: 
        index = url_list.index("#")
        url_list = url_list[:index]
    
    return ("".join(url_list))
        
    # TODO: complete


def remove_url_anchor(url):
    anchor_pos = url.find('#')
    if anchor_pos > 0:
        return url[:anchor_pos]
    return url
    


import re
def remove_url_anchor(url):
    urlRegex = re.compile(r'#(.*)')
    mo = str(urlRegex.sub('',url))
    return mo

print(remove_url_anchor("www.codewars.com/katas/"))

def remove_url_anchor(url):
    char_list = list(url)
    anchor_index = len(char_list)
    for number in range(0, len(char_list)):
        if (char_list[number] == "#"):
            anchor_index = number
    without_anchor = "".join(char_list[number] for number in range(0, anchor_index))
    return without_anchor

def remove_url_anchor(url):
    c=""
    for ch in url:
        if ch== "#":
            break
        c+=ch
    return c

def remove_url_anchor(url):
    new = url.find('#')
    
    if new > 0:
        return url[0:new]
    else:
        return url
    # TODO: complete


def remove_url_anchor(url):
    ans = ""
    for index in range(0,len(url)):
        if url[index] != '#':
            ans += url[index]
        else:
            break
    return ans


import re
def remove_url_anchor(url):
    return re.match(r'[^#]*', url).group()

def remove_url_anchor(url):
    l1=list()
    for i in range(len(url)):
        if(url[i]!='#'):
            l1.append(url[i])
        else:
            break
    return ''.join(l1)


def remove_url_anchor(url):
    a = []
    for i in url:
        if i == "#":
            break
        a.append(i)# TODO: complete
    return "".join(a)

def remove_url_anchor(url):
    if "#" in url:
        return url[:url.index("#"):]
    else:
        return url

def remove_url_anchor(url):
    lst=url.split('#')
    url=str(lst[0])
    return url

import re
def remove_url_anchor(url):
    match = re.search(r'[^#]+', url)
    if match:
        return match.group()
    else:
        return url


def remove_url_anchor(url):
    if '#' not in url:
        return url
    else:
        get_index = list(url).index('#')
        return url[:get_index]

def remove_url_anchor(url):
    # TODO: complete
    new_url = ""
    for char in url:
        if char == "#": break
        new_url = new_url + char
        
    
    return new_url

import re
def remove_url_anchor(url):
    return re.match(r'(.+)#', url)[1] if '#' in url else url

def remove_url_anchor(url):
    splt = url.split('#',1)
    sub = splt[0]
    return sub

def remove_url_anchor(url):
    ans = url.split('#')
    return ans[0]
    # TODO: complete


def remove_url_anchor(url):
    
    s = ""
    
    for i in range(len(url)):
        
        if url[i]=='#':
            
            break
            
        else:
            
            s+= url[i]
            
    return s

    
    


def remove_url_anchor(url):
    return url[:list(url).index('#')] if '#' in url else url

def remove_url_anchor(url):
    a = 0
    for i in url:
        if  i == '#':
            a = url.index(i)
    return url[:a] if a != 0 else url

def remove_url_anchor(url):
    return "".join(url.split("#")[:1])

def remove_url_anchor(url):
    count = 0
    if "#" in url:
        newUrl = url.replace(url[url.find("#"):], "")
        return newUrl
    else:
        return url
    


def remove_url_anchor(url):
    j = 0
    for i in url:
        j +=1
        if i == '#':
            print(j)
            url = url[0:(j-1)]
            return url
        else:
            pass
    return url
        


def remove_url_anchor(url):
  index = url.find('#')
  if index == -1:
    return url
  else:
    return url[0:index]

def remove_url_anchor(url):
    accum = []
    for char in url:
        if char != "#":
            accum.append(char)
        if char == "#":
            break
    return "".join(accum)

def remove_url_anchor(url):
    new_url = ""
    if "#" in url:
        i = url.index("#")
        new_url = url[0: i]
    else:
        new_url = url
    return new_url

def remove_url_anchor(url):
    url = url.split(sep="#")
    return url[0]

def remove_url_anchor(url):
    newString = ''
    for i in url:
        if i != '#':
            newString = newString + i
        if i== '#':
            break
    return newString

def remove_url_anchor(url):
    
    l = ""
    
    for i in url:
        if i!= "#":
            l+= i
            
        else:
            break
    return l

def remove_url_anchor(url):
    # TODO: complete
    s = "#"
    l=len(url)    
    pos = url.find(s)       
    if pos<=l and pos>0:
        url = url[:(l-(l-pos))]        
    return url

def remove_url_anchor(url):
    url1 = url.split("#", 1)
    subs= url1[0]
    return(subs)

def remove_url_anchor(url):
    line=[]
    for x in url:
        if x!='#':
            line.append(x)
        else:
            break
    return ''.join(line)

import re

def remove_url_anchor(url):
    pattern = re.compile(r'^([^#]+)(#[.]*)*')
    m = re.match(pattern, url)
    return m.group(1)

def remove_url_anchor(url):
    if '#' in url:
        anchorPosition = url.find('#')
        return url[:anchorPosition]
    else:
        return url

def remove_url_anchor(url):
    try:
        site, _ = url.split('#')
    except ValueError:
        return url
    else:
        return site

def remove_url_anchor(url):
    for x in url:
        y=len(url)
        if x =="#":
            y=url.index(x)
            break
    return url[ :y]

import re
def remove_url_anchor(url):
    return re.search(r"^[^#]+", url).group()

def remove_url_anchor(url):
    ans = ''
    for char in url:
        if char is '#':
            break    
        ans += char    
    return ans

from re import sub

def remove_url_anchor(url):
    return sub('#.+', '', url)

def remove_url_anchor(url):
    if '#' in url:
        slicer = url.index('#')
        return url[:slicer]
    else:
        return url

from re import search
def remove_url_anchor(url):
    pattern = r'(\A.+(?=#))'
    match = search (pattern, url)
    return match.group () if match else url

def remove_url_anchor(url):
    final=""
    for letter in url:
        if letter=="#":
            break
        else:
            final+=letter
    return final
        
    # TODO: complete


def remove_url_anchor(url):
    idx = url.find('#')
    if idx == -1: return url
    return url[:idx]

def remove_url_anchor(url):
    for letter in url:
        if letter == "#":
            x = url.index(letter)
            return url[0:x]
        
    return url
    # TODO: complete


def remove_url_anchor(url):
    ans = '' 
    for i in range(len(url)):
        if url[i]=='#':
            break
        else:
            ans += url[i]
    return ans


def remove_url_anchor(url):
    try:
        a = url.index("#")
        return url[:a]
    except Exception:
        pass
    return url

def remove_url_anchor(url):
    string = ''
    for letter in url:
        if letter != '#':
            string += letter
        else:
            break
    return string

def remove_url_anchor(url):
    url = url.rsplit('#')
    return url[0]

def remove_url_anchor(url):
    try: return url[:url.index('#')]
    except: return url[:]


from re import sub
remove_url_anchor = lambda url: sub('#.*', '', url)

def remove_url_anchor(url):
    l = url.split('#',1)
    return l[0]