How to I add spaces between two inputs?

Viewed 39

So in the last line it prints the name together no spaces how do I fix this so there is a space in between?

print("What is your first name?")
firstname = input()
print("What is your last name?")
lastname = input()
print("Hello", firstname+lastname)
3 Answers
print(f"Hello {firstname} {lastname}")

There are a lot of ways ;) :

print(f'Hello {firstname} {lastname}')

Or

print("Hello", firstname, lastname)

Or

print("Hello", firstname + ' ' + lastname)

Or

print(' '.join(["Hello", firstname , lastname]))

Or

[print(i, end=' ') for i in ["Hello", firstname, lastname]]

Here are some ways to make it:
The first one:

print(f"Hello {firstname} {secondname}")

The second one:

print("Hello", firstname, secondname)
Related