-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emasatsugu python bootcamp #10
base: master
Are you sure you want to change the base?
Conversation
DONE! |
|
||
def size(dictionary): | ||
""" | ||
Returns the number of words in the English `dictionary`. | ||
""" | ||
pass | ||
return len(list(dictionary)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to transform dictionary into a list! you can just call len(dictionary)
|
||
# PROB 2 | ||
# Return the sum of all the numbers in lst. If lst is empty, return 0. | ||
def sum_list(lst): | ||
return 0 | ||
sum = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return sum(lst)
python has lots of built-in functions! http://docs.python.org/2/library/functions.html (e.g. sum, sorted, max, min, ...) Learning how to use these effectively will make your code look better, simpler, and more "python"-ic! |
Oh wow I'm doing way too much work. Okay I'll take a look at that website On Monday, November 18, 2013, Kenny Yu wrote:
|
vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] | ||
for letter in s: | ||
if letter in vowels: | ||
news = news.replace(letter, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to have the 'for letter in s' loop--just loop over vowels and remove them from s!
woooooo you finished! awesome use of git! |
No description provided.