Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Neo4j Data Modeling

Authors: Steve Hoberman ,David Fauth

1st Edition

1634621913, 978-1634621915

More Books

Students also viewed these Databases questions

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago

Question

Decision Making in Groups Leadership in Meetings

Answered: 1 week ago