I am new to Python, my second week doing it.
I have a code I wrote where one enters year a car was made and it outputs price.
When I enter 1961, I get what I want. When I enter 1962 I get my result.
How can I structure the code such that if I enter any given year period it gives a correct price? Outside the range, it gives an error message. After entering a year and getting a result the user has the option to enter another year or to exit.
year = int(input('Enter year:\n'))
if year < 1962:
print('Car did not exist yet!')
print('Please enter a valid year from 1962'),int(input('Please enter another year:\n'))
if year <= 1964:
print('$', 18500), int(input('Please enter another year:\n'))
if year >= 1965 <=1968:
print('$', 6000), int(input('Please enter another year:\n'))
if year >=1969 <=1971:
print ('$', 12000), int(input('Please enter another year:\n'))
Thank you for any feedback. I tried if/elif to no avail.