Talk:O'Reilly Introduction to Python
There are no discussions on this page.
Return to "O'Reilly Introduction to Python" page.
I'm currently on Lesson 18: Headlines. We're given a list of headlines and supposed to output all headlines with a length less than 35 characters. I'm posting my code below and it prints the proper headlines, but when I click submit, I am being told, "Oops, try again. Your output didn't match what I was expecting. Double-check your `if` condition and try again." Please advise.
headlines = ["Man Takes First Steps on the Moon", "Titanic Sinks Four Hours After Hitting Iceberg", "Dewey Defeats Truman", "Greatest Crash in Wall Street's History"]
maximum_headline_length = 35 for hl in headlines:
if len(hl) < maximum_headline_length: print(hl)