HackerRank- Python String Split and Join

Given a string. Split the string on a " " (space) delimiter and join using a - hyphen.

  1. def split_and_join(line):
  2. a=line.split(" ")
  3. result="-".join(a)
  4. return result
  5. if __name__ == '__main__':
  6. line = input()
  7. result = split_and_join(line)
  8. print(result)


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube