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
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.
+ 3
Saja Ali
You're welcome
Rik Wittkopp
Just sharing with fellow SoloLearner that's all
+ 2
Oh thank you very much this thing confused me
+ 2
Ipang Best answer