ChrisH667 / pwp-capstones

0 stars 1 forks source link

Ignore empty strings #1

Open gabriel1200 opened 5 years ago

gabriel1200 commented 5 years ago

The for loop her needs to ignore empty strings. There's a number of ways to check for this, the easiest of this would likely be ensuring the x.strip() method doesn't return a null value, like so. for x in split_text: if not x.strip(): continue counter += 1 sentence = x.split(' ') sen_total.append(len(sentence))

Otherwise, I would also recommend giving yourself a more descriptive variable name when iterating through split_text. Something like "line".