Very simple but not working

name = input ('what is your name? ’ )
age = input ('how old are you? ')
Gender = input('sex? (m/f) ')
birth_year = 2021 - int(age)
print ('Your Name is: ’ + name)
print ('your Age is: ’ + age)
print ('your Gender is: ’ + Gender)
print ('your birth year is: ’ + birth_year)

Hello guys, I am very new and I have no experience in any programming before, so i tried making one just to gauge my understanding of the tutorial. I do not know what went wrong here, is there any rules as to why the last line is giving error?

String literals in Python are enclosed in apostrophes. You are using an accent to close the string literal. In the last line you are using the + operator with a string and an int operand which is not allowed. You can use + to concatenate two strings or to add two numbers.

1 Like