Having trouble converting 2 str to int

Calculate age fron string to int


year = input("What year is it? ")
brith_year = input("What year were you born? ")

Variable And Conversion

age = int(year) - int(birth_year)


print("Your are " + age)

or print(“Your are”, age)

That is my code but i can get the user input from both but after both user inputs i get an error when trying to convert and print. Can anyone tell me why, i feel like its simple. This was from my android phone so i was using py3 app. I usually program in c++ and wouldnt have a problem but learning python. Python is simpler and less lines of coding but input and output is different in c++ and i would not have a problem if it were c++.

In order to preserve formatting, please select any code or traceback that you post and then click the </> button.

age is an integer, so when you say "You are " + age you’re asking Python to add a string to an integer, which isn’t allowed.

You can convert to a string using str: "You are " + str(age).

Alternatively, you can use formatting, e.g. ‘f-strings’:

print(f"You are {age}")

Ahh ok, I see what your saying, thank you. Going from c++ to python is different. I am beginning to like python though it is simpler and way less lines of coding. Thank you for replying and helping me with that.

Lol I also cant spell apparently bbecause i defined brith_year not birth_year