Home > Net >  An empty line is added at the end, you need to make n-the number of lines
An empty line is added at the end, you need to make n-the number of lines

Time:12-21

Python. It is necessary to make n-the number of rows. I succeed, but an empty line is added at the end, how can I remove it?

a = int(input())
phrase = "Hello!"
final = f"{phrase} \n"
print (final * a)

CodePudding user response:

Your code will look the following:

a = int(input())
phrase = "Hello!"*a
final = f"{phrase} \n"
print (final * a,end="")

CodePudding user response:

a = int(input())
phrase = "Hello!"
final = f"{phrase} \n"
print (final * a,end="")
  • Related