2023-11-19 23:03:43 -07:00
|
|
|
# Runestone.Academy thinkcspy course
|
|
|
|
|
# Chapter 12
|
|
|
|
|
# Lab 1
|
|
|
|
|
|
2023-11-19 20:45:18 -07:00
|
|
|
def countAll(text):
|
|
|
|
|
wordDict = {}
|
|
|
|
|
|
|
|
|
|
for char in text:
|
|
|
|
|
if char not in wordDict and char.isalpha():
|
|
|
|
|
wordDict[char] = text.count(char)
|
|
|
|
|
|
|
|
|
|
return wordDict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(countAll("banana"))
|
|
|
|
|
print(countAll("curly fries 123!"))
|