Created
February 19, 2020 17:47
-
-
Save mayankdawar/bea4eef0b9001821f8179daf037d2d0c to your computer and use it in GitHub Desktop.
For each string in the list words, find the number of characters in the string. If the number of characters in the string is greater than 3, add 1 to the variable num_words so that num_words should end up with the total number of words with more than 3 characters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = ["water", "chair", "pen", "basket", "hi", "car"] | |
num_words = 0 | |
for i in words: | |
if len(i) > 3: | |
num_words += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
isn't right. Your loop statement means: for words less than 3 characters.... Read the task carefully: "in the string is greater than 3"