+ 2
How do I make the output of the code below to be left indented?
print("******World's Shortest Story****") def myfx(Guy,Lady): print(Guy, "Smiled\n", Lady, "Blushed\nEveryone Else Burned") myfx(input("Enter your name and that of your spouse to get your love story\nGuy:"),input("Lady:")) output: Guy Smiled, Lady Blushed, Everyone Else Burned
2 Antworten
+ 2
You can do in several ways:
Just use spaces, come on:
print('Hello\n world!')
> Hello
> world!
Also you can use \t :
print('Hello\n\tworld!')
> Hello
> world!
0
Asman-H method seem to work for me best. I also added new line character before first line for output.
print("******World's Shortest Story****")
def myfx(Guy,Lady):
print('\n', Guy, 'Smiled\n', Lady, "Blushed\n Everyone Else Burned")
myfx(input("Enter your name and that of your spouse to get your love story\nGuy:"),input("Lady:")
Output:
Guy Smiled,
Lady Blushed,
Everyone Else Burned