Consecutive outputs in the same line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Consecutive outputs in the same line

It's possible to do two or more consecutive outputs in the same line? For example, I have a while loop whose output is "Yes." It's possible to obtain "Yes. Yes. Yes." instead of Yes. Yes. Yes. ?

27th Jan 2017, 1:24 AM
Jonas Oliveira
Jonas Oliveira - avatar
2 Answers
+ 6
i = 0 x = "Yes." while i < 3: print(x, end = "") i += 1 output will be Yes.Yes.Yes.
27th Jan 2017, 2:49 AM
Kawaii
Kawaii - avatar
+ 3
yes.. use a string variable to store the response and print the string at the end of the loop
27th Jan 2017, 1:53 AM
jay
jay - avatar