How can I made output in one line in stead of many lines. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

How can I made output in one line in stead of many lines.

https://code.sololearn.com/cP720R9zjpDf/?ref=app

30th Oct 2022, 4:14 PM
Vive MX
Vive MX - avatar
4 Respuestas
+ 9
Vive MX , this is a nice code! (just for your information:) if we need more than one sample / character as output, we can use random.choices(). this can generate *k* random characters in one go, without using an additional for loop: print(''.join(random.choices(x+y+z, k=13))) this line can replace the last 2 lines of your code.
30th Oct 2022, 5:51 PM
Lothar
Lothar - avatar
+ 5
In the print statement, you can customize the end character with the end parameter. So you can set the end to an empty string instead of the default '\n'. print('hello ', end='') print('world') This would display as 'hello world'. For better code, I'd recomend you to not print at each new character of the password. You could instead append to an existing string and print the result at the end. I hope this helps :)
30th Oct 2022, 4:22 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 2
Yes it is solved 👍
30th Oct 2022, 4:47 PM
Vive MX
Vive MX - avatar
+ 1
Ya, you are right
30th Oct 2022, 11:11 PM
Vive MX
Vive MX - avatar