I'm am working on my first attempt writing a program that opens a Wikipedia page based on year entered, but each time I run the program, the tabs open for every year I have listed so far.
I have tried writing it as a for loop, while loop, and (attempted and if statement); how can I make it so only one tab opens for the correct input year? `
year_entered = input("year of interest? ")
year = ''
ninety_five = webbrowser.open_new_tab('https://en.wikipedia.org/wiki/1995/')
#this is repeated for years 1995-2020
#I've also tried *while True:*
for year_entered in range(1995, 2000):
year = str(year_entered)
if year == "1995":
print(ninety_five)
break
elif year == "1996":
print(ninety_six)
break
Thank You