Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок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. ?
2 ответов
+ 6
i = 0
x = "Yes."
while i < 3:
print(x, end = "")
i += 1
output will be Yes.Yes.Yes.
+ 3
yes.. use a string variable to store the response and print the string at the end of the loop