The code provided is supposed replace all the dots `.` in the specified String `str` with dashes `-`

But it's not working properly.

# Task

Fix the bug so we can all go home early.

# Notes

String `str` will never be null.

Difficulty: introductory

Starter code:

def replace_dots(str):
	

Solutions:
def replace_dots(string):
    return string.replace('.', '-')

import re
def replace_dots(str):
    return re.sub(r"\.", "-", str)
    # literally I had to only add a \ infront of the dot.
    # this challenge is super hard for noobs and super easy for pros. it's not fair.


import re
def replace_dots(s):
    return s.replace(".", "-")

replace_dots = lambda x: x.replace(".","-")

def replace_dots(str):
    if "." in str:
        return str.replace(".","-")
    elif str == "no dots":
        return "no dots"
    else:
        return ""

import re
def replace_dots(str):
    return re.sub(r"\.", "-", str, flags=re.MULTILINE)

import re
def replace_dots(s):
    return re.sub(r"\.", "-", s)

from re import sub

def replace_dots(_str: str) -> str:
    """ Replace all dots in given text by dashes. """
    return sub("\.", "-", _str)

import re
def replace_dots(str):
    return str.replace('.', '-')

import re

def replace_dots(s):
    return re.sub("[.]", "-", s)


def replace_dots(s):
    return s.replace(r".", "-")

replace_dots = lambda s:''.join(['-' if i == '.' else i for i in s])

import re
def replace_dots(str):
    result = ''
    for ch in str:
        if ch =='.':
            result += '-'
        else:
            result += ch
    return result

import re
def replace_dots(s):
    x = re.sub(r'[.]', '-', s)
    return x

import re
def replace_dots(s):
    for char in s:
        if char==".":
            s=s.replace(char,"-")
    return s

from re import sub
def replace_dots(s):
    return sub("\.", "-", s)

import re
def replace_dots(s):
    s = re.sub(r"\.", "-", s)
    return s 

def replace_dots(s):
    return '-'.join(s.split('.'))

def replace_dots(s):
    if s == "":
        return ""
    elif "." not in s:
        return 'no dots'
    else:
        return s.replace(".", "-")


def replace_dots(s):
    return "".join(['-' if i == '.' else i for i in s ])

import re
def replace_dots(s):
    print(s)
    return re.sub("\.", "-", s)

def replace_dots(s):
    s = list(s)
    i = 0
    while i < len(s):
        if s[i] == '.':
            s[i] =  '-'
        i += 1
  
    return ''.join(s) 

def replace_dots(s):
    return s.replace('.', '-', len(s))

#import re
def replace_dots(s):
    return s.replace(r".", "-")

import re
def replace_dots(s):
    return re.sub(r"[.+]", "-", s)

def replace_dots(s):
    return s.replace(".", "-") if "." in s else s

def replace_dots(s):
    if s == "":
        return ""
    else:
        return s.replace(".", "-")

import re
def replace_dots(s):
    return re.sub(r"[\.]", "-", s)


def replace_dots(s):
    s=s.replace('.','-')
    return s

import re
def replace_dots(s):
    if len(s) == 0: return ""
    if "." in s:
        return s.replace(".","-")
    else: return s

replace_dots = lambda s: ''.join(['-' if c == '.' else c for c in s])

def replace_dots(s):
    res = s.replace('.', '-')
    return res



def replace_dots(s):

    if s == "":
    
        return ""

    for i in s:
    
        if not '.' in s:
        
            return "no dots"
        
        else:
        
            for j in range(len(s)):
            
                if s[j]=='.':
                
                    v = s.replace(s[j],'-')
                    
                    return v
                    
                    
        
        
    


import re
def replace_dots(s):
    return s.replace(r".", r"-",)

from re import sub
def replace_dots(s):
    return sub(r"\.", "-", s)

import re
def replace_dots(s):
    #the '.' needs to be preceded by \ for it to be treated as '.' character
    #else, re interprets . as any character and replaces all chars with -
    return re.sub(r"\.", "-", s)

import re
def replace_dots(s):
    if len(s) == 0: return ""
    
    return re.sub("\.", "-", s) if "." in s else "no dots"

import re
def replace_dots(s):
  if '.' in s: 
    
    return s.replace(".", "-")
  else:
    return s


def replace_dots(s):
    return s.replace(".", "-")
    # Flez


import re
def replace_dots(s):
    return re.sub(r"[.]", "-", s)

def replace_dots(s):
    x = s.replace('.', '-')
    return x

import re

# Don't use a class name like str as an argument name
def replace_dots(str):
    return str.translate(str.maketrans(".", "-"))
    return str.replace(".", "-")
    return re.sub(r"\.", "-", str)

import re
def replace_dots(s):
    return re.sub("\.","-",s)

import re
def replace_dots(str = ''):
    return re.sub('[.]', '-', str)

import re
def replace_dots(str):
    output = ''
    for i in str:
        if i == '.':
            output += '-'
        else:
            output += i
    return output

import re
def replace_dots(str):
    return re.sub(r"\.", r"-", str)
#Solved on 27th Sept,2019 at 06:25 PM.


def replace_dots(x):
    return(x.replace(".","-")) 

def replace_dots(str):
    return __import__('re').sub(r"\.", "-", str)

def replace_dots(str1):
    
    return str1.replace(".", "-")


str1 = 'one.two.three'
print(replace_dots(str1))

def replace_dots(st):
    print(("==>> ",st))
    if len(st) == 0:
        return ''
    num_dots = 0
    for lletra in st:
        if lletra == ".":
            num_dots += 1
    if num_dots > 0:
        return st.replace('.','-')
    else:
        return "no dots"




import re
def replace_dots(str):
    return re.sub(r"\.", "-", str)  #I solved this Kata on  7/29/2019  03:33 AM...#Hussam'sCodingDiary

def replace_dots(string):
    while "." in string: string = string.replace(".", "-")
    return string

import re
def replace_dots(str):
    if '.' in str:
        return str.replace(".", "-")
    else:
        return str

def replace_dots(str):
    for i in range(len(str)):
      if str[i] =='.':
        str=str.replace(str[i],'-')
    return str

import re
def replace_dots(str):
    return ''.join(['-' if i =='.' else i for i in str])

import re
def replace_dots(str):
    return re.sub("[\\.]", "-", str)

replace_dots = lambda str: str.replace('.', '-')

import re
def replace_dots(re):
    return re.replace(".", "-")

from re import sub
def replace_dots(string):
    return sub(r'\.', '-', string)

def replace_dots(stroka):
    return stroka.replace(".", "-")

def replace_dots(str):
    str = str.replace(".", "-")
    return str

import re
def replace_dots(str):
    a = re.sub(r"\.", "-", str)
    return a

import re
def replace_dots(str):
    replaced = re.sub(r'\.','-', str)
    return replaced

import re
def replace_dots(str):
    new = re.sub(r"\.", "-", str)
    return new

import re
def replace_dots(str):
    return re.sub(r"\.", r"-", str)

import re
def replace_dots(s):
    intab = '.'
    outtab = '-'
    trantab = str.maketrans(intab,outtab)
    return s.translate(trantab)

import re
def replace_dots(str):
    compiler = re.compile(r'\.')
    return compiler.sub("-", str)


def replace_dots(str):
    return str.replace(".", "-", len(str))

def replace_dots(blah):
    return blah.replace(".", "-")

def replace_dots(str):
    output = ""
    for element in str:
        if element == ".":
            output += "-"
        else:
            output += element
    return output            

def replace_dots(str):
    if "." in str:
        return str.replace(".", "-")
    elif not str:
        return ""
    else:
        return "no dots"

import re
def replace_dots(string):
    return re.sub(r"\.", "-", string)

def replace_dots(strng):
    strng = strng.replace(".","-")
    return strng

def replace_dots(strng):
    return strng.replace(".", "-")

import re
def replace_dots(x):
    return re.sub('\.', '-', x)


def replace_dots(str):
    return "".join(x if x != "." else "-" for x in str)

import re
def replace_dots(str):
    return "no dots" if set(str)=={'-'} else re.sub(r"\.", "-", str)

import re
def replace_dots(str):
    return str.replace(".","-") # no re needed

def replace_dots(str):
    a = str.replace(".","-")
    return a

def replace_dots(str):
    return "".join([x if x != "." else "-" for x in str])

import re
def replace_dots(str):
    return re.sub("\\.", "-", str)

import re
def replace_dots(str):
    print(str)
    return re.sub(r"\.", "-", str)

def replace_dots(str):
    string = str.replace('.', '-')
    return string

import re
def replace_dots(str):
    print(str)
    return re.sub("\.","-",str)

def replace_dots(str):
    import re
    if str == '':
        return str
    return re.sub('\.', '-', str) if str.count('.') else 'no dots'

import re
def replace_dots(strg):
    return re.sub(r"\.", "-", strg)

def replace_dots(str):
    dash = str.replace('.', '-')
    return dash

replace_dots = lambda s: s.replace('.','-')


def replace_dots(str):
    change = '.'
    for element in str:
        if element in change:
            str = str.replace(element, '-')
    return str

def replace_dots(str):
    if len(str) == 0:
        return ''
    else:
        return str.replace('.','-') if '.' in str else "no dots" 

import re
def replace_dots(str):
    if str == "":
        return re.sub(r".", "-", str)
    return str.replace(".", "-")

import re
def replace_dots(str_):
    if "." in str_: 
        return str_.replace(".", "-") 
    elif str_ is "":
        return ""
    else: 
        return "no dots"

import re
def replace_dots(s):
    if s=='':return ''
    if '.' not in s:return 'no dots'
    return re.sub(r"\.", "-", s)


def replace_dots(str_):
    return str_.replace(".","-")

import re
def replace_dots(str):
    return str.replace(r".", "-", 100)

import re
def replace_dots(e):
    return e.replace(".", "-")

def replace_dots(str):
    arr = []
    for i in str:
        if i == '.':
            arr.append('-')
        else:
            arr.append(i)
    
    b = ('').join(arr)
    
    return b


import re
def replace_dots(string):
    return string.replace(".","-") if "." in string or string == '' else "no dots"

def replace_dots(str):
    return str if '.' not in str else str.replace('.', '-')


import re
def replace_dots(string):
    if string == "":
        return ""
    else:
        return string.replace('.', '-') if '.' in list(string) else 'no dots'