0
How to write all in the same line (beginer problem)
I have made this beginner basic program. It must take a number and if it is odd, multiply it by 3 and add 1, if it is even, divide it by 2 until reaching 1. This program works, but I would like to be able to write the results in the same line. E.g .: results are (8, 4, 2, 1). this program writes: 8.0 4.0 2.0 1.0 I can't use lists, i have to solve it with the basics, like while, if, for, functions, etc. but i don't know how. https://code.sololearn.com/ch7KS3FnkFB5/?ref=app
1 Respuesta
+ 2
Use end-of-line specifier while printing the values. Here's an example to use a space as end-of-line character.
print( A, end = ' ' )