Question: Please modify this Python code according to instructions: firstName = input(Enter your first name: ) lastName = input(Enter your last name: ) birthYear = input(Enter

Please modify this Python code according to instructions:

firstName = input("Enter your first name: ") lastName = input("Enter your last name: ") birthYear = input("Enter your birth year: ") currentYear = input("Enter the current year: ") fullName = firstName + " " + lastName age = int(currentYear) - int(birthYear) print("Hello " + fullName + ". You are",age, "years old.")

Instructions:

    1. Use the string.join() function to combine firstName and lastName (instead of using the + symbol)
      1. hint: youll have to modify the initialization value of fullname
  1. Add the following code after your last line of code.
    1. Create a new string variable called helloStmnt that holds the value of your previous print function
      1. hint: the one that prints Hello [fullname]. You are [age] years old.
    2. Create a new list variable called stmntList using the split()function on the variable helloStmnt
    3. Print Your first name is [first name from the new stmntList list]
      1. hint: you will have to reference the position in the list to get the first name

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!