String Split and Join

Sort by

recency

|

1109 Discussions

|

  • + 0 comments

    It’s a great example of how Python makes common string operations intuitive and readable. A perfect warm-up for beginners learning string manipulation! 11xplay.com account create

  • + 0 comments

    def split_and_join(line): a = line.split(" ") a = "-".join(a) return a if name == 'main': line = input() result = split_and_join(line) print(result)

  • + 0 comments

    def split_and_join(line): result1 = line.split() result ='-'.join(result1) return result

    if name == 'main': line = input() result = split_and_join(line) print(result)

  • + 0 comments

    def split_and_join(line): # write your code here s=line.split(" ") #s=s.split(" ") #print(s) s="-".join(s) return(s)

  • + 0 comments

    Try this: def split_and_join(line): # write your code here string="" for i in range(0,len(line)): if line[i]== " ": string=string+"-" else: string=string+line[i] return string *without using join or split

    if name == 'main': line = input() result = split_and_join(line) print(result)