String Split and Join | HackerRank
String Split and Join | HackerRank
Use Python's split and join methods on the input string.
www.hackerrank.com
Goal
Replace " "(space) into - (hyphen) in string.
Solution
You can use replace function in string to replace space into hyphen.
It is very useful function. So, please remember this function!
# String Split and Join
def split_and_join(line):
# write your code here
split_line = line.replace(' ', '-')
return split_line
if __name__ == '__main__':
line = input()
result = split_and_join(line)
print(result)
'software Engineering > (Python)HackerRank' 카테고리의 다른 글
[Python] HackerRank - Mutations (0) | 2023.02.14 |
---|---|
[Python] HackerRank - What's Your Name? (0) | 2023.02.11 |
[Python] HackerRank - sWAP cASE (0) | 2023.02.03 |
[Python] HackerRank - Lists (0) | 2023.02.02 |
[Python] HackerRank - Finding the percentage (0) | 2023.02.01 |