0

I am to write a python code to the following:

Ask the user to enter the first name and store it in the first_name variable. Ask the user to enter the second name and store it in the last_name variable. Print the full name.

I have tried it repeatedly but it kept on giving errors.

first_name = input("Enter your first name: Ade ")

last_name = input("Enter your last name:Olu ")

full_name = first_name + last_name

print(full_name)

And the expected outcome is:

Ade Olu

  • 1
    Please let us know, what kind of errors you get. Your code works perfectly, just tried it. Because of you code: You know, that the input command expects something from the command line? So you should not put the name in the output, but type it in the command line when prompted. first_name = input("Enter your first name: ") last_name = input("Enter your last name: ") full_name = first_name + " " + last_name print(full_name) – juran.maurice Feb 16 '23 at 09:15
  • Does this answer your question? [Asking the user for input until they give a valid response](https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response) – jkalandarov Feb 19 '23 at 06:15

0 Answers0