Reputation: 119
So only useful part of code is
print(gender)
print(age)
print(height)
print(health[randomm])
print(hobby[randomm])
print(phobia[randomm])
print(character[randomm])
print(inventory[randomm])
print(additionalInformation[randomm])
print(cardN1[randomm])
print(cardN2[randomm])
The output is
2
103
199
Ишемическая болезнь сердца
Благотворительность
Авиафобия
Доброта
Набор инструментов
В 1998 году выпил первую бутылку пива.
Поменятся с одним человеком болезнью 1 раз.
Поменяться случайному человеку болезнь.
I copied it right from console and my main question is how i can removes those empty lines?
Upvotes: 0
Views: 253
Reputation: 330
What is happening here is that print
adds a newline when printing a string. When printing "test\n"
, you end up with "test\n\n"
, which creates blanks.
>>> print("test\n")
test
You have multiple options here. You can remove the \n
from the string:
>>> print("test\n".strip())
test
Or remove the automatic newline from print
:
>>> print("test\n", end='')
test
Upvotes: 1
Reputation: 304
Use the .replace()
string = "Hello \n World"
print(string.replace("\n", ""))
Upvotes: 2
Reputation: 232
you dont need to write separate print function for each line. just write all the lines in a single print function with \n in between those statements.
print(health[randomm]\nhobby[randomm])
Upvotes: 0