I am wondering how you can let a given user input create new lines automatically. Like for instance:
JavaScript
x
2
1
summary = input("Please write a short summary")
2
Let the user input for example be:
JavaScript
1
2
1
An age-old vendetta between two powerful families erupts into bloodshed. A group of masked Montagues risk further conflict by gatecrashing a Capulet party. A young lovesick Romeo Montague falls instantly in love with Juliet Capulet, who is due to marry her father's choice, the County Paris.
2
Now I actually want this to be displayed as:
JavaScript
1
4
1
An age-old vendetta between two powerful families erupts into bloodshed.
2
A group of masked Montagues risk further conflict by gatecrashing a Capulet party.
3
A young lovesick Romeo Montague falls instantly in love with Juliet Capulet, who is due to marry her father's choice, the County Paris.
4
As you can see in the last example, it is creating new lines each time. I know you can create new lines with /n, but not how to import this into user inputs automatically, I hope you understand with the example given above.
Advertisement
Answer
How about this :
JavaScript
1
2
1
print(summary.replace('. ','.n'))
2
Output:
JavaScript
1
4
1
>An age-old vendetta between two powerful families erupts into bloodshed.
2
A group of masked Montagues risk further conflict by gatecrashing a Capulet party.
3
A young lovesick Romeo Montague falls instantly in love with Juliet Capulet, who is due to marry her father's choice, the County Paris.
4