0

How to make the output of for loop to be in one line and not on different lines

t="go over there" p=t. split() c=0 b=len(p) while c< b: r=(list(p[c])) s=p[c][0] r.remove(s) r.append(s) r.append("ay") c+=1 print("".join(r)) #output #ogay #veroay #heretay # but what i really want is # ogay veroay heretay # when I run it I want the result to be togather not each word spearated on different lines how do i do that

1st Jan 2020, 10:24 AM
Pattern
Pattern - avatar
4 Réponses
+ 6
print("".join(r), end = " ") By default print() ends the printing session with a new line character, which moves the cursor position to the next line. Customising the 'end' value with a space makes print() ends the printing session with a space.
1st Jan 2020, 10:30 AM
Ipang
+ 3
Saja Ali You're welcome Rik Wittkopp Just sharing with fellow SoloLearner that's all
1st Jan 2020, 10:38 AM
Ipang
+ 2
Oh thank you very much this thing confused me
1st Jan 2020, 10:34 AM
Pattern
Pattern - avatar
+ 2
Ipang Best answer
1st Jan 2020, 10:34 AM
Rik Wittkopp
Rik Wittkopp - avatar