+ 2
How can I made output in one line in stead of many lines.
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.
+ 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 :)
+ 2
Yes it is solved 👍
+ 1
Ya, you are right