-2

I started learning Python in school and got an assignment to make a code where you input a year number (for example, 1980) and get the first two numbers (19 in this example) with 00 and the Swedish text shown in the picture.

My problem is that there is space between the first 2 numbers and the rest of the numbers and the text. How can I remove this space in between?

I did not know what to do so I did not try anything

taylorSeries
  • 505
  • 2
  • 6
  • 18
  • Welcome to Stack Overflow! Please edit your post to include the code directly, rather than as an image. Posting the code as an image prevents us from being able to easily copy-paste and debug your code and also makes it much harder for future readers to find this question and benefit from it. You can format code by indenting four spaces, or by enclosing the code block in triple backticks. – Silvio Mayolo Aug 26 '23 at 00:17

1 Answers1

1

By default, the arguments to print are displayed with a separator of a single space. You can override this with the optional keyword argument sep, which can be set to any delimiter you choose, including the empty string.

print("A", "B") # Prints "A B"
print("A", "B", sep=",") # Prints "A,B"
print("A", "B", sep="") # Prints "AB"

In your case, the empty string should suffice.

print(x, "00", sep="")
Silvio Mayolo
  • 62,821
  • 6
  • 74
  • 116