Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
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 Antworten
+ 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