Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please Help
#1
So im in introduction to programming and we use python and the assignment is
Create a program that prompts the user to enter a first name and a last name separately. The program then concatenates the names (using +) and displays the full name using Title capitalization, even if the names were entered in lower case.

my issue is i'm not able to capitalize both the first and last name when it's entered and get a space at the same time as i'm using a + to connect first_name and last_name commands please help me solve this so I can learn because everything i've tried hasn't worked.
Reply
#2
I'm sure it's not the best practice, but in the past I've added spaces by putting in a string that just contains a space.

You say you have to use title() So you just have to make a string that is the first and second names, and apply the title method.

full_name_string = str(first_name + " " + second_name)
print(full_name_string.title())
It works at least lol
Reply
#3
Use .title() on both user inputs, before concatenating.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020