Remove .md and image files and move python files into main chapter folders
This commit is contained in:
parent
5978779a9a
commit
67806dab6a
159 changed files with 0 additions and 4562 deletions
21
thinkcspy/Chapter-10-Exercises/Problem12.py
Normal file
21
thinkcspy/Chapter-10-Exercises/Problem12.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Runestone.Academy thinkcspy course
|
||||
# Chapter 10
|
||||
# Problem 12
|
||||
|
||||
def count(lst):
|
||||
# your code here
|
||||
wordCount = 0
|
||||
|
||||
for item in lst:
|
||||
if type(item) is str:
|
||||
if item != "sam":
|
||||
wordCount += 1
|
||||
else:
|
||||
wordCount += 1
|
||||
return wordCount
|
||||
|
||||
return wordCount
|
||||
|
||||
myList = ["apple", 5, 6, True, "purple", False, "mushroom", 11, "gen-x", "sam", 7, 10, "cause", "interim"]
|
||||
|
||||
print(count(myList))
|
||||
Loading…
Reference in a new issue