Feb-07-2020, 03:26 PM
I am creating an application that requests first name, last name, and age (based off of year born). I believe I have the variables all correct as they ran properly separately. When I try to print fullname and age, I'm running into issues. Currently the code is as:
firstname = input("What is your first name?")
lastname = input("What is your last name?")
fullname = firstname = " " + lastname
currentyear = 2020
birthyear = input("What year were you born? ")
ibirthyear = int(birthyear)
age = currentyear - ibirthyear
print("Welcome" + fullname, age)
When I run the application, it asks for my first name, last name, and year born. But the output eliminates the first name, prints the last name, and the correct age. What alterations are necessary for me to keep my first name in the solution? Is the final line incorrect, or did I mess something up in a previous variable?
firstname = input("What is your first name?")
lastname = input("What is your last name?")
fullname = firstname = " " + lastname
currentyear = 2020
birthyear = input("What year were you born? ")
ibirthyear = int(birthyear)
age = currentyear - ibirthyear
print("Welcome" + fullname, age)
When I run the application, it asks for my first name, last name, and year born. But the output eliminates the first name, prints the last name, and the correct age. What alterations are necessary for me to keep my first name in the solution? Is the final line incorrect, or did I mess something up in a previous variable?