+ 3
Please can explain how to input new lines on python
4 Respostas
+ 6
print('whatever')
ends with a newline automatically.
When you want an extra newline, you can use an empty
print()
Or you end your string on the former line with \n.
print('Extra!\n')
+ 2
You can get multiple lines from input by this code:
lines = []
while True:
line = input()
if line:
lines.append(line)
else:
break
0
Hello guys
- 1
Simply \n