My code doesn't work?

def my_join(*paths):
  joined = ''
  for path in paths:
    sep = ''
    if path[0] != '/':
      sep = '/'
    if path[-1] == '/':
      clean_path = path[:-1]
    else:
    	clean_path = path
    joined += sep+str(clean_path)
  return joined

a = 'a/c/sa/'
b = '/b'
c = 'c/'
abc = my_join(a,b,c)
print(abc)

why doesn’t it complete the task? The output is correct.

1 Like

My solution also worked, but didn’t pass.

def myjoin(*paths):
  return_val = ''
  for path in paths:
    if path[0] == "/":
      return_val. = return_val + path
    else:
      return_val = return_val + "/" + path

  return return_val