So I’m teaching myself python online using ‘Programming with Mosh’ on Youtube. I’m looking at type conversion, and Mosh is discussing how you cannot subtract a string from an integer.
However, when I ran my program as per his tutorial, it actually works perfectly without crashing. Can anyone explain why this is happening?
This is the code I used, and according to his tutorial this should generate an error.
birth_year = input("Enter your birth year: ")
age = 2022 - birth_year
print(age)