Introduction to Python

Advanced printing - end

Every time print() is used to print something, the next print() already prints from a new line. But in some cases, you might want to stay on the same line.
print('hello', 'everyone', end='...')
print('Anyone here?')
This program would print hello everyone...Anyone here?. So, instead of printing Anyone here? from a new line, the program stayed on the same line as end was set to ....
By default, the end parameter is set to \n, which is a special symbol that represents the new line. We will cover the special symbols and what they do later in the course. For now, we’ll cover only one - \n the new line symbol.
print('one', 'two', end='--')
print('three', 'four', end='!!!')
print('five', 'six', 'seven', end='\n')
print('eight', end='nine')
print('ten', end='... the end...')
This program would result in:
one two--three four!!!five six seven
eightnineten... the end...


Use 12 print statements to print all the months in a year. At the end of each month, there should be a *-* except for the last one.
Here is the list of all months: January, February, March, April, May, June, July, August, September, October, November, and December.


Time limit: 1 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue