Hi there! This is my approach to think python written by Allen Downey. You can see his book there and code there and I adapted his answers in some of solutions (see my code to find out where). To find a particular exercise, you can search through the index. Cheers!
- 3-1 right_justify
- 3-2 do_twice, do_four, print_twice, etc
- 3-3 draw_4x4_grid
- 4-1 stack diagram for circle(bob, radius)
- 4-2 draw flower with turtleWorld
- 4-3 draw pies
- 4-4 draw letters
- 4-5 draw spirals
- 5-1 time convert
- 5-2 implementation of Fermat's Last Theorem
- 5-3 triangle check
- 5-4 stack diagram on recursive function
- 5-5 read koch recursive function
- 5-6 draw Koch curve and snowflake
- 6-1 stack diagram for calling functions
- 6-2 Ackermann function with simple control flow
- 6-3 palindrome check
- 6-4 is_power check
- 6-5 the great common divisor(GCD) calculator
- 7-1 test square root with math module
- 7-2 eval function in loop
- 7-3 Srinivasa Ramanujan's estimation of pi
- 8-1 experiments with string methods
- 8-2 count 'a' in 'banana'
- 8-3 one line is_palindrome
- 8-4 explanation of 5 functions
- 8-5 rotate by n characters
- 9-1 read words.txt
- 9-2 has_no_e
- 9-3 avoids and forbidden letters
- 9-4 uses_only
- 9-5 uses_all(inverse of uses_only)
- 9-6 is_abecedarian checks string's alphabetic order
- 9-7 cartalk1: find consecutive double words
- 9-8 cartalk2: find self-palindromic numbers
- 9-9 cartalk3: find my and mom's age
- 10-1 nested_sum
- 10-2 cumsum (cumulative sum)
- 10-3 middle, which takes a list without first and last element
- 10-4 chop, same as middle but returns None
- 10-5 is_sorted, check list in ascending order
- 10-6 is_anagram
- 10-7 has_duplicates
- 10-8 Birthday_paradox
- 10-9 two methods to add elements to list
- 10-10 check whether a word is in the list with in operator and bisect
- 10-11 reverse_pair
- 10-12 interlock
- 11-1 store words in words.txt as dictionary
- 11-2 inverse_dict with setdefault method
- 11-3 ackmann_memo
- 11-4 dictionary version of has_duplicates
- 11-5 dict version of rotate
- 11-6 homophone (sound check)
- 12-1 letter frequecy
- 12-2 anagram search and sort
- 12-3 metathesis pairs
- 12-4 longest reducible words
- 13-1 read a text file and breaks to words with stripped string.puncutation and string.whitespace
- 13-2 read a text file from project Gutenberg and count number of words
- 13-3 count 20 most frequently used word
- 13-4 subtract_version_1
- 13-5 choose_from_hist
- 13-6 subtract_with_set
- 13-7 choose_from_hist_version_2
- 13-8 Markov analysis
- 13-9 Zipf's law implementation
- 14-1 a function reads a file and change the pattern string with replacement string and output the file
- 14-2 store dictionary in a file and look up a dictionary from given file
- 14-3 search a directory recursively and find out duplicates by md5sum check
- 15-1 class and objects instantiation
- 15-2 combine turtle and class, math proof for overlapping problem(back in 15-1)
- 16-1 mul_time
- 16-2 datetime, time, timedelta, etc manipulation
- 17-1 rewrite time class in methods
- 17-2 debug kangroo class (list initialization)
- 18-1 UML diagram for PingPong
- 18-2 deal_hand (Deck)
- 18-3 add methods to PokerHand class
has_pair
,has_twopair
- 19-1 conditional expression