0

With a while loop, how it is possible to output a list of number ending each with a dot.

input: x = 0 while x<=5: print(x) x += 1 expected output: 1. 2. 3. 4. 5.

9th Jul 2022, 8:12 AM
Alex | Python Instructor & Solutionist Thinker
Alex | Python Instructor & Solutionist Thinker - avatar
3 ответов
+ 5
print(str(x) + '.')
9th Jul 2022, 8:51 AM
Slick
Slick - avatar
+ 5
Read this page, especially the "Preventing Line Breaks" section. You can see the use of `end` argument for print() function to customize what to print at end of printing operation - when all arguments given for print() function had been printed. https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-print/
9th Jul 2022, 8:54 AM
Ipang
9th Jul 2022, 8:51 AM
A͢J
A͢J - avatar