Talk:O'Reilly Introduction to Python

From OpenHatch wiki
Jump to navigation Jump to search

All,

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)