├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── babynames ├── baby1990.html ├── baby1992.html ├── baby1994.html ├── baby1996.html ├── baby1998.html ├── baby2000.html ├── baby2002.html ├── baby2004.html ├── baby2006.html ├── baby2008.html ├── babynames.py └── solution │ └── babynames.py ├── basic ├── alice.txt ├── list1.py ├── list2.py ├── mimic.py ├── small.txt ├── solution │ ├── list1.py │ ├── list2.py │ ├── mimic.py │ ├── string1.py │ ├── string2.py │ └── wordcount.py ├── string1.py ├── string2.py └── wordcount.py ├── copyspecial ├── copyspecial.py ├── solution │ └── copyspecial.py ├── xyz__hello__.txt └── zz__something__.jpg ├── hello.py └── logpuzzle ├── animal_code.google.com ├── logpuzzle.py ├── place_code.google.com └── solution └── logpuzzle.py /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Code for Google's Python Class 2 | Copyright 2010 Google Inc. 3 | 4 | This code developed by Nick Parlante 5 | at Google Inc. 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Google Python Class 2 | 3 | These are my solutions as I go through [Google's Python Class](http://developers.google.com/edu/python/). 4 | -------------------------------------------------------------------------------- /babynames/baby2002.html: -------------------------------------------------------------------------------- 1 | Popular Baby Names 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 19 | 20 | 21 | 27 | 28 | 29 |
15 | Social Security Online 16 | 17 | Popular Baby Names 18 |
22 | Popular Baby Names 23 | SSA logo: link to Social Security home page 26 |

Popular Names by Birth Year

September 12, 2007
30 | 31 |
32 | Background information 33 |


34 |   Select another ?
35 |

36 |   37 | 38 | 39 |  
40 |
41 |

Popularity in 2002

42 |

43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 |
RankMale nameFemale name
1JacobEmily
2MichaelMadison
3JoshuaHannah
4MatthewEmma
5EthanAlexis
6AndrewAshley
7JosephAbigail
8ChristopherSarah
9NicholasSamantha
10DanielOlivia
11WilliamElizabeth
12AnthonyAlyssa
13DavidLauren
14TylerIsabella
15AlexanderGrace
16RyanJessica
17JohnBrianna
18JamesTaylor
19ZacharyKayla
20BrandonAnna
21JonathanVictoria
22JustinMegan
23DylanSydney
24ChristianRachel
25SamuelChloe
26AustinJasmine
27BenjaminSophia
28NathanJennifer
29LoganMorgan
30JoseNatalie
31NoahKaitlyn
32GabrielHailey
33KevinJulia
34RobertDestiny
35CalebHaley
36ThomasKatherine
37JordanNicole
38HunterAlexandra
39CameronSavannah
40KyleMaria
41ElijahStephanie
42JasonMackenzie
43JackMia
44AaronAllison
45IsaiahJordan
46LukeAmanda
47ConnorJenna
48IsaacFaith
49AngelMakayla
50JacksonPaige
51BrianMary
52EricBrooke
53MasonKatelyn
54JuanRebecca
55AdamMadeline
56EvanAndrea
57LuisKaylee
58CharlesMichelle
59SeanSara
60AidanZoe
61GavinKylie
62AlexSierra
63NathanielKimberly
64BryanAaliyah
65CarlosAmber
66JesusGabrielle
67IanCaroline
68StevenVanessa
69ColeAlexa
70TimothyTrinity
71CodyDanielle
72SethErin
73AdrianAutumn
74DevinShelby
75LucasAngelina
76BlakeRiley
77RichardGabriella
78JulianJada
79PatrickLily
80SebastianMelissa
81TrevorJacqueline
82ChaseAva
83DominicAngela
84JaredBailey
85AntonioIsabel
86JeremiahJade
87JadenLeah
88MiguelCourtney
89XavierElla
90JesseMaya
91GarrettLeslie
92AlejandroJocelyn
93MarkAriana
94OwenMelanie
95JeremyClaire
96HaydenLillian
97BryceChristina
98DiegoEvelyn
99RileyMarissa
100VictorAudrey
101JaydenCatherine
102JakeBriana
103TristanKatie
104KennethBreanna
105CarsonAlexandria
106MarcusLaura
107CarterMolly
108DakotaKathryn
109JorgeAmy
110SpencerAngel
111TannerIsabelle
112KalebSofia
113LiamDaniela
114StephenArianna
115HenryAshanti
116ColinGabriela
117DaltonDiana
118PaulKelsey
119WyattKelly
120EdwardMadelyn
121OscarAlicia
122VincentLindsey
123JoelCaitlin
124BrendanJillian
125ColbyMikayla
126ParkerCassandra
127GrantCheyenne
128ColtonAlexia
129MaxwellMargaret
130ShaneMariah
131GeorgeCassidy
132JeffreyAvery
133EduardoLizbeth
134PeterAna
135AidenSabrina
136IvanKennedy
137NicolasLydia
138BraydenDaisy
139DerekAmelia
140GageSkylar
141FranciscoTiffany
142LandonAdriana
143RicardoMckenzie
144TravisErica
145CristianMya
146JalenAngelica
147BradyMiranda
148CollinCaitlyn
149BradleySophie
150AlanKaren
151OmarSummer
152ShawnBrooklyn
153CadenGracie
154JosiahCrystal
155PrestonJordyn
156ErikKiara
157JavierValerie
158AndresAshlyn
159FernandoHeather
160DevonHope
161AlexisKylee
162CesarAlondra
163DamianGianna
164ManuelJamie
165MaxAbby
166JonahErika
167LeviKarina
168BradenBianca
169GregoryNaomi
170JohnathanBrittany
171MarioJuliana
172NolanVeronica
173KadenNatalia
174MicahMeghan
175EdgarKarla
176MitchellCynthia
177RaymondMckenna
178ClaytonChelsea
179EdwinBethany
180TrentonMonica
181CoreyDelaney
182ErickPayton
183WesleyJasmin
184EmmanuelShannon
185ScottJulianna
186SergioKristen
187MarcoKyla
188RobertoPeyton
189DustinMaggie
190TaylorNevaeh
191DonovanAlejandra
192MartinHayley
193DawsonKate
194HectorHanna
195CooperAubrey
196ConnerKendall
197EliValeria
198BrettMakenzie
199HarrisonReagan
200AshtonEllie
201DillonRylee
202GiovanniMichaela
203JakobAliyah
204AbrahamCharlotte
205PeytonEsmeralda
206AlecCarly
207CadeDiamond
208AndyRuby
209AndreJazmin
210MalachiJayla
211MalikRebekah
212DamienSadie
213TreyBrenda
214TyDesiree
215JaylenAriel
216FrankNadia
217DrewGiselle
218EliasJulie
219RubenKaitlin
220JosueAddison
221CalvinMacy
222ZaneAdrianna
223SkylerKara
224DominickClaudia
225PedroAlana
226PhillipKyra
227RonaldKendra
228GriffinGenesis
229BrysonJazmine
230LeonardoAlison
231TrentHolly
232RafaelElena
233ChanceNancy
234GerardoAllyson
235DerrickSavanna
236JohnnyBritney
237DariusRaven
238ChandlerElise
239MilesEva
240RaulJoanna
241CaseyMakenna
242SimonJaden
243ArmandoNina
244KobeSerena
245AveryGuadalupe
246AllenFatima
247MarcosSelena
248KeithHaylee
249TroyVivian
250EnriqueCamryn
251IsraelKatelynn
252DonaldCierra
253KeeganMallory
254ZackaryApril
255PaytonLindsay
256JulioCameron
257DanteMariana
258JaimeCindy
259BrendenLiliana
260KameronKathleen
261LanceWendy
262AlbertoLucy
263PhilipNayeli
264BrockJosephine
265GustavoAnastasia
266DrakeAsia
267JimmyCamille
268OliverZoey
269JonathonCecilia
270DannyKassandra
271FabianYesenia
272LouisSkyler
273MathewKristina
274BrennanAshleigh
275CorySandra
276KaiHeaven
277KylerKira
278AngeloKirsten
279BrodyPatricia
280DennisKatrina
281JaceJosie
282MarcAmaya
283TonyKailey
284GaryMiriam
285CamdenPriscilla
286RomanTori
287JerryTatiana
288ArturoBridget
289SaulLayla
290DamonSerenity
291CurtisCarolina
292CorbinMadeleine
293RandyMercedes
294EmanuelTessa
295PabloTara
296TuckerJayden
297LorenzoKiana
298AlbertRachael
299LaneMelody
300TheodoreCasey
301MylesAlissa
302DarrenEsther
303AlfredoChristine
304BryantNatasha
305DouglasCarmen
306LarryClara
307TysonLauryn
308GraysonCeleste
309ChadAlaina
310JaxonPaola
311QuinnIndia
312JoeBryanna
313AxelHalle
314MaximusShayla
315TristenAnnie
316MelvinAlexus
317LukasBrittney
318NickolasImani
319RamonEleanor
320AliNia
321SantiagoDenise
322AydenHeidi
323ErnestoDakota
324ZacheryKayleigh
325BaileySidney
326MaximilianAnne
327ArthurMarisa
328RussellBrenna
329KristopherLogan
330BraxtonAnnabelle
331WalterRose
332JaysonEmilee
333ZionLilly
334JusticeDaniella
335JayCallie
336MoisesCiara
337EstebanDana
338EmilioRuth
339IsmaelKassidy
340LeoHelen
341DallasRosa
342TommyClarissa
343SalvadorCristina
344RickyHarley
345LawrenceKamryn
346MarvinAnnika
347EzekielFiona
348MichealAshlynn
349CamronDeanna
350CarlWhitney
351ReeceJadyn
352QuentinYasmin
353MauricioAshlee
354AbelJenny
355MateoHallie
356BrayanMadalyn
357JaheimMeredith
358IsiahKristin
359NikolasAnahi
360AmirDominique
361BraedenEliza
362JefferyLisa
363BrentPaulina
364JamalElisabeth
365DeandreEden
366JonCarolyn
367KadeTalia
368MarshallSasha
369HugoVirginia
370BrandenLaila
371RodneyAllie
372DeanJulissa
373MorganHailee
374OrlandoTamara
375JaidenKaylie
376CaydenTeresa
377JarrettTiana
378MauriceAshton
379CraigGeorgia
380TerryAlayna
381WestonGloria
382ChrisIris
383SkylarMarina
384EddieAngie
385KolbyAniya
386ReeseCarla
387RogerLinda
388ConorGillian
389JaylinJayda
390KeatonTabitha
391DavisRaquel
392KodyTatum
393RodrigoEmely
394TrevonEliana
395FelixKrystal
396KelvinRegan
397ZachariahGenevieve
398JessieMarisol
399JaylonKaitlynn
400BobbyKiley
401BrendonNoelle
402ShaunJustice
403JuliusLexi
404AhmadIvy
405GuillermoLesly
406JavonBaylee
407WalkerFrancesca
408AldoAlisha
409ZackeryMonique
410GrahamAmerica
411QuintonTania
412HoldenAniyah
413NelsonIzabella
414IssacGina
415JohnathonPerla
416JadonJane
417CharlieKatlyn
418ClayMadisyn
419OsvaldoRenee
420DorianCarissa
421ReneHaleigh
422DemetriusDeja
423KhalilPrecious
424BillyMartha
425DesmondSage
426MalcolmMalia
427ReginaldBella
428FrederickCheyanne
429NasirMarie
430QuincyAlivia
431SilasJessie
432DamionAmari
433HarleyAlina
434BlaineKaleigh
435DavionAurora
436ElliotJaqueline
437WilliePhoebe
438JonasTia
439DeclanKyleigh
440RoyRylie
441EzraItzel
442TerranceLeilani
443SamMadyson
444AdanAlice
445BennettAlyson
446GeraldSkye
447ReidViviana
448JermainePiper
449KennyGisselle
450NoelLeila
451UrielMeagan
452FelipeNyla
453TyreseAinsley
454SteveCamila
455NathanaelMckayla
456TateFernanda
457KristianJanet
458DaneEmilie
459EmilianoJacquelyn
460SolomonKarissa
461KendallYasmine
462TomasBrooklynn
463AlvinReese
464NoeParis
465TristonJohanna
466AdenCora
467BruceTaryn
468WilsonNora
469ToddShania
470CyrusAbbey
471FranklinLacey
472AmariAyanna
473MosesKrista
474TerrellMacie
475RylanSusan
476TobyEllen
477LandenKaylin
478AllanJoy
479RogelioKiersten
480DarianCara
481HudsonKiera
482CedricJanelle
483JasperLiberty
484JaquanAbbigail
485AsherAnya
486ByronTamia
487DuncanAraceli
488TristinCarley
489JeromeDestinee
490StanleyMikaela
491KendrickKasey
492LeonAlanna
493ReedDulce
494AlfonsoKierra
495DaleRyleigh
496JoaquinElisa
497FrancisAngelique
498SawyerBrandy
499DaytonMaddison
500CobyStella
501MarquisLitzy
502KaydenMayra
503MohamedAthena
504RodolfoWillow
505RamiroKaley
506BeauCharity
507TyroneJaiden
508AhmedLorena
509JoeyAnika
510JohanLarissa
511MarlonKailee
512DevenSharon
513ArielTheresa
514RandallTiara
515DevanPamela
516BraydonIrene
517LeeSarai
518RohanSylvia
519TraceMadelynn
520PierceJanae
521HarryAnn
522GilbertoMiracle
523AlonzoRaegan
524LucaTyler
525JaydonLucia
526KaidenBailee
527WarrenBrandi
528JamieElaina
529JudeJaclyn
530RossRyan
531MohammadSonia
532TobiasAbbie
533ZanderMaia
534ElliottKelsie
535OmarionRhiannon
536RolandoShakira
537TyrellJaelyn
538WadeMarlene
539WayneCassie
540EastonAileen
541JayceJoselyn
542LeonelMarilyn
543UlisesEmilia
544MekhiAlma
545XanderLena
546DarrellSimone
547BenColleen
548EugeneJimena
549WillKaya
550AddisonFelicity
551IsaiasKali
552RonnieKaila
553JarodKenya
554KieranMelina
555JordonLexie
556ColemanAspen
557GunnarEve
558TerrenceNataly
559VicenteBarbara
560EzequielDeborah
561ColtenHunter
562LeonardCarlie
563DeshawnLesley
564IzaiahIsis
565RudyMaritza
566AdolfoAimee
567JamariMadilyn
568KoltonChasity
569RomeoDaphne
570GarretTanya
571MohammedEdith
572SavionHailie
573TyreeAdrienne
574NeilMacey
575SageJulianne
576DominiqueGwendolyn
577DominikJustine
578AlvaroArielle
579KobyFelicia
580JaxsonShyanne
581EfrainAlly
582RayBrynn
583BrennenHaylie
584OrionKaia
585JaronReyna
586HaroldLilian
587KeenanZaria
588SterlingJudith
589EverettKailyn
590ErnestZoie
591GilbertNathalie
592DavonJuliette
593HumbertoLuz
594LewisNoemi
595SalvatoreClare
596RashadJaniya
597MikeTianna
598AgustinAnnette
599TitusHelena
600DonteKaylyn
601ElishaSavanah
602JettJuliet
603DarrylValentina
604YahirChelsey
605BriceXimena
606DashawnEsperanza
607JulienThalia
608LincolnMara
609KarlTatyana
610DarienHayden
611KoleViolet
612RiverSkyla
613GradyElle
614DwayneTess
615JamarNyah
616PhoenixBreana
617GlennJolie
618CullenLila
619KadinPaula
620JamesonFrances
621AlonsoHana
622JairoJazlyn
623JairLisbeth
624KareemTeagan
625KeonLaney
626AntoineCristal
627ElvisJaida
628QuintinRegina
629RalphAisha
630DevonteMarley
631JuniorAlisa
632MosheAmya
633CristopherHaven
634DavinLara
635NathanialIsabela
636GunnerRosemary
637RoderickAntonia
638IgnacioAlessandra
639KaneElaine
640CruzKarli
641FreddyKeely
642KeshawnMicah
643AronNya
644JamisonYadira
645IrvinCarlee
646JustusLeticia
647JudahJanessa
648TalonToni
649ShamarKaelyn
650AntonNichole
651JaggerCelia
652NehemiahKaiya
653KamronLillie
654MarkusCarina
655ZechariahAracely
656AlfredCayla
657DerickCorinne
658IbrahimKenzie
659MuhammadMollie
660GarrisonSydnee
661MarquiseHalie
662StefanStacy
663AndersonKarlee
664AugustSienna
665DevynLea
666NigelAnaya
667DaquanEileen
668RhettLana
669KurtTina
670AsaHarmony
671ReynaldoMariam
672HeathStephany
673JoshLaurel
674GordonAmani
675KeyshawnDonna
676SidneyMariela
677DonavanAnsley
678KarsonEbony
679CaidenLeanna
680RaphaelTyra
681KellenKelli
682JarredAyana
683ZakaryJewel
684AlijahMontana
685PorterMelany
686SheldonMonserrat
687HowardTaliyah
688RigobertoAdeline
689LayneJazmyn
690OctavioLizeth
691ClarenceTayler
692DarnellGiovanna
693DeonKathy
694JeanKianna
695MiltonPresley
696MisaelBrisa
697DillanEstefania
698EmmettArely
699JaylanDesirae
700RoryBria
701BrodieChaya
702JabariEstrella
703DemarcusJoyce
704GreysonKarlie
705JeffersonKennedi
706KenyonJenifer
707OmariAubree
708DenzelShayna
709MaximillianDelilah
710GianniMaeve
711AlessandroBrielle
712AriAnnabella
713DarionCiera
714JaedenLia
715AlexandroPenelope
716KeyonTierra
717NicoBlanca
718AmarionYvette
719DandreDestiney
720DravenMyah
721GaelShyann
722KevonIngrid
723KeaganCasandra
724RyderDamaris
725SantosQuinn
726IsaiSheila
727ClintonKatarina
728GavenMaci
729GonzaloAleah
730CamrenAlena
731LamarAnnalise
732JarrodMaribel
733GeoffreyKayley
734BrycenMargarita
735RolandAria
736KoreyShaniya
737BrooksSydni
738TariqCandace
739DallinKasandra
740DangeloNikki
741JahiemAliya
742ShannonCecelia
743CaleGia
744ConradLyric
745FrankieAlize
746ThaddeusAbigayle
747XzavierJanice
748BradKatelin
749BraidenMarianna
750QuintenMicaela
751SemajIyana
752AbdullahYazmin
753WaylonCarrie
754AustynLola
755BabyGreta
756BernardSusana
757StephanFrida
758AlexzanderNicolette
759GermanSalma
760HamzaSandy
761KeltonAmira
762PerryArlene
763RoccoEvelin
764GiancarloDayana
765HassanParker
766JacobyElyse
767RonaldoHazel
768SincereLexus
769TravonStacey
770EmersonDevin
771GuadalupeLiana
772ReaganMattie
773ArmaniChristian
774CaelMakena
775ElmerReilly
776JarenKellie
777JoanCalista
778JovanAnissa
779KhalidCeline
780AntonyKaliyah
781BrunoShaylee
782DarinDestini
783SheaKayli
784GideonMaura
785TristianAiyana
786DarriusKacie
787DimitriKaylynn
788JamelLilliana
789WinstonElissa
790DeonteJaylin
791JavionAmara
792JordenKarly
793MatteoAyla
794BlazeDasia
795EstevanCatalina
796JovaniIliana
797ReubenJoslyn
798TreKendal
799MaverickCarson
800SeamusShea
801BlaiseTaniya
802FinnJacey
803HeribertoBelen
804IsaakLizette
805ClarkRocio
806KeanuScarlett
807MiloFabiola
808DestinAlysa
809JordyJamya
810NormanKatharine
811ChazKenna
812LeroyGretchen
813SonnyRayna
814UlyssesAnnabel
815KorbinAryanna
816DexterJaliyah
817ElianAliza
818RowanAshly
819BraedonCali
820DeangeloChristy
821ReillyElsa
822AustenEricka
823RonanJalyn
824JustynJaycee
825TrevionRaina
826TreytonTracy
827StoneDiane
828AdrienCelina
829DionKenia
830FredrickRobyn
831NickDevon
832SammyEmerson
833BrentonEmmalee
834EarlMiah
835TylorDenisse
836YosefDanna
837KevenJasmyn
838KurtisSavana
839SamirAbigale
840AugustusLondon
841CliffordJaidyn
842LawsonBerenice
843PaxtonMadisen
844VanceBryana
845DarioEssence
846AbramChristiana
847BernardoKaylah
848JakobeRobin
849KennedyVanesa
850NestorKourtney
851DeshaunMakaila
852ForrestMoriah
853JosefAlia
854MarcelCarol
855NathenJaime
856ColtKeyla
857KianChrista
858TavionMeadow
859BarryPrincess
860GavynRianna
861ShayneMireya
862CorneliusRoxana
863DomenicAnita
864HughBrianne
865AdityaGiana
866BennyBeatriz
867AdonisJaylynn
868BretPatience
869CordellTristan
870StuartSelina
871AryanCarli
872JadynDorothy
873KylanJoana
874LondonSally
875MarceloHadley
876NashSarahi
877TreverRebeca
878FredShirley
879HoustonAlexandrea
880IrvingJailyn
881LamontPriscila
882LatrellAbagail
883RemingtonNoelia
884KellyMaleah
885OswaldoShreya
886EfrenKallie
887TyshawnElyssa
888ChaimSarina
889JaheemAshtyn
890NikhilDylan
891SamsonLyndsey
892GlenKya
893LaytonSky
894PranavDalia
895ZaireDarlene
896ArnoldJana
897MalakaiShawna
898DarylJayde
899FidelMadalynn
900JavenYuliana
901LisandroArmani
902AldenJakayla
903DarwinMaegan
904KaleMaliyah
905SantinoSaige
906LonnieSonya
907DylonReanna
908EllisSamira
909EthenAlexys
910RaymundoDevyn
911StephonKelsi
912CarltonSade
913DuaneSydnie
914GiovannyJalynn
915JanMarlee
916AdrielMyra
917GinoJoelle
918HadenRachelle
919ZainYessenia
920BarrettAkira
921LucianoIsabell
922MarquezMeaghan
923MitchelNorma
924ReyRita
925TurnerSamara
926VernonUnique
927ZavierCandice
928GaigeGraciela
929GuyKalyn
930LucPaloma
931MaximoTaya
932RickeyGalilea
933RyleeKaela
934VaughnMelinda
935AntwanJourney
936CasonKaty
937DarrinYvonne
938JamilAnjali
939KaseyAylin
940RahulBreonna
941AubreyKeira
942DarrionMandy
943EliseoRyann
944MustafaBaby
945JamirJanie
946JevonAmina
947MikelJaylene
948PierreMina
949KentMiya
950NealDania
951SabastianDarby
952SyedLuisa
953TrystanOdalys
954BilalDeasia
955EddyRiya
956GannonKarley
957JaquezEstefany
958KyreeIyanna
959MaximCadence
960ArjunCitlali
961JarvisKiya
962JovanyAllyssa
963BradynAlysha
964CarloIreland
965DontaeMarcella
966JaseChana
967ZayneTrista
968CliftonDianna
969CortezJaylyn
970ShemarJena
971DwightAja
972KoryAlycia
973DevanteJaquelin
974HerbertYolanda
975KirkAlex
976OsbaldoKari
977TrevinLibby
978ZackNyasia
979FreddieAbril
980GarettBrionna
981JeffAubrie
982KristoferLina
983PrinceLoren
984BoMagdalena
985CristobalSheridan
986EliezerEstefani
987GiovaniKeeley
988ImmanuelMaryam
989RyleyChandler
990SullivanJazmyne
991LloydJeanette
992JovanniYareli
993NikoJackeline
994AltonJohana
995EanJuana
996MarianoKristine
997RavenAmiya
998YousefKaterina
999DonCaitlynn
1000FletcherEmerald
Note: Rank 1 is the most popular, 1050 | rank 2 is the next most popular, and so forth. 1051 |

1052 |
1053 | 1054 | 1055 | 1062 | 1063 |
 Link to FirstGov.gov: U.S. Government portal 1058 | Privacy Policy  1059 | | Website Policies 1060 | & Other Important Information  1061 | | Site Map
1064 | 1065 | -------------------------------------------------------------------------------- /babynames/baby2004.html: -------------------------------------------------------------------------------- 1 | Popular Baby Names 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 19 | 20 | 21 | 27 | 28 | 29 |
15 | Social Security Online 16 | 17 | Popular Baby Names 18 |
22 | Popular Baby Names 23 | SSA logo: link to Social Security home page 26 |

Popular Names by Birth Year

September 12, 2007
30 | 31 |
32 | Background information 33 |


34 |   Select another ?
35 |

36 |   37 | 38 | 39 |  
40 |
41 |

Popularity in 2004

42 |

43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 |
RankMale nameFemale name
1JacobEmily
2MichaelEmma
3JoshuaMadison
4MatthewOlivia
5EthanHannah
6AndrewAbigail
7DanielIsabella
8WilliamAshley
9JosephSamantha
10ChristopherElizabeth
11AnthonyAlexis
12RyanSarah
13NicholasGrace
14DavidAlyssa
15AlexanderSophia
16TylerLauren
17JamesBrianna
18JohnKayla
19DylanNatalie
20NathanAnna
21JonathanJessica
22BrandonTaylor
23SamuelChloe
24ChristianHailey
25BenjaminAva
26ZacharyJasmine
27LoganSydney
28JoseVictoria
29NoahElla
30JustinMia
31ElijahMorgan
32GabrielJulia
33CalebKaitlyn
34KevinRachel
35AustinKatherine
36RobertMegan
37ThomasAlexandra
38ConnorJennifer
39EvanDestiny
40AidanAllison
41LukeSavannah
42JackMaria
43JordanNicole
44AngelHaley
45IsaiahMackenzie
46IsaacBrooke
47JasonMakayla
48JacksonTrinity
49HunterKylie
50CameronKaylee
51MasonPaige
52GavinFaith
53AaronLily
54JuanZoe
55KyleStephanie
56CharlesJenna
57LuisAndrea
58AdamRiley
59BrianKatelyn
60AidenAngelina
61EricKimberly
62JaydenMary
63AlexMadeline
64SeanLeah
65BryanLillian
66OwenMichelle
67LucasAmanda
68NathanielSara
69IanSofia
70JesusJordan
71CarlosRebecca
72AdrianAlexa
73DiegoGabrielle
74JulianCaroline
75ColeVanessa
76AshtonGabriella
77JeremiahAvery
78StevenMarissa
79TimothyAriana
80SethAudrey
81ChaseJada
82DevinAutumn
83JadenEvelyn
84ColinMaya
85CodyJocelyn
86LandonArianna
87HaydenIsabel
88CarterAmber
89XavierMelanie
90WyattDiana
91DominicDanielle
92RichardSierra
93AntonioLeslie
94JesseAaliyah
95BlakeErin
96SebastianAmelia
97MiguelMolly
98JakeClaire
99AlejandroMelissa
100PatrickBailey
101CarsonBrooklyn
102VictorKatie
103AlexisCatherine
104CadenNevaeh
105KadenAngela
106RileyAmy
107BraydenIsabelle
108BryceJacqueline
109HenryJade
110TrevorGabriela
111JeremyMadelyn
112LiamShelby
113MarkMariah
114GarrettGracie
115TristanMya
116MarcusKennedy
117IvanBreanna
118JorgeDaniela
119KalebAdriana
120VincentBriana
121KennethCourtney
122BradyKathryn
123OscarChristina
124JoelGianna
125TannerAlexandria
126EduardoLydia
127JaredMiranda
128PaulAngel
129EdwardLaura
130CollinAlicia
131AlanAshlyn
132ParkerAlexia
133CooperMargaret
134ConnerPeyton
135ColtonSophie
136MaxwellRylee
137DakotaKendall
138NicolasKelly
139CristianAna
140StephenSummer
141GrantKylee
142PeterNatalia
143RicardoDaisy
144JosiahReagan
145GageNaomi
146GeorgeLindsey
147OmarKate
148BrendanKelsey
149FranciscoSabrina
150JeffreyAlondra
151SpencerMckenzie
152PrestonJillian
153BradenCheyenne
154LeviSkylar
155FernandoKaren
156DerekMikayla
157CesarParis
158JavierRuby
159DamianPayton
160EliAddison
161NolanCaitlin
162PeytonKyla
163MicahJuliana
164MaxCaitlyn
165ShaneCrystal
166TravisAbby
167DaltonLayla
168ManuelCassidy
169AndresDelaney
170EdgarCharlotte
171ShawnMariana
172ErikBianca
173EdwinCassandra
174EmmanuelValeria
175DevonTiffany
176BradleyAngelica
177JonahCarly
178MarioAlana
179MalachiHope
180ErickValerie
181TyGiselle
182AydenJasmin
183JohnathanErica
184WesleyJazmin
185ColbyGenesis
186TrentonMallory
187DonovanJordyn
188RaymondKiara
189GiovanniEllie
190JalenAubrey
191MarcoSerenity
192HectorErika
193AbrahamVeronica
194GregoryChelsea
195LeonardoKarla
196DamienSadie
197DillonKarina
198ClaytonEva
199SergioJamie
200AndreJulianna
201BrysonBrenda
202RobertoMckenna
203MartinLucy
204JaylenCeleste
205AndyAlejandra
206DawsonMaggie
207EliasAmaya
208JosueBethany
209HarrisonZoey
210BrodyEsmeralda
211DrewLilly
212CoreyAdrianna
213MitchellMakenzie
214ScottElena
215IsraelNadia
216TaylorJayla
217DominickMeghan
218RubenCadence
219CalvinKyra
220BraxtonAriel
221MilesAliyah
222BrettCamryn
223DustinCynthia
224RafaelLiliana
225AveryElise
226PedroMonica
227TroyMakenna
228JaceKailey
229OliverAlison
230FrankLizbeth
231ZaneHanna
232RonaldVivian
233CamdenMacy
234SkylerDesiree
235GerardoJayden
236JakobRebekah
237TreyHaylee
238PaytonAllyson
239RomanCarmen
240GriffinBrittany
241ArmandoLindsay
242RaulJosephine
243MalikNina
244MarcosHeather
245BrockHayley
246AlecJazmine
247KaiAsia
248PhillipLaila
249DerrickKara
250ChanceJaden
251CadeCameron
252JohnnyCamille
253KeithJoanna
254SimonCarolina
255EnriqueKatelynn
256AllenShannon
257KeeganKeira
258TrentReese
259XanderJulie
260JaidenBella
261CaseySelena
262DrakeAniya
263DonaldRaven
264CaydenKristen
265LeoGuadalupe
266JaxonPiper
267FabianAlaina
268JulioDiamond
269AngeloHeaven
270CorbinClaudia
271DanteFatima
272GraysonKendra
273JaimeSavanna
274KylerMiriam
275LanceKira
276KameronDakota
277BrendenCecilia
278EmanuelTessa
279ZanderApril
280JimmySandra
281LandenKatrina
282ChandlerAshlee
283AlbertoKayleigh
284TysonMichaela
285AdanClara
286DariusAshlynn
287ZackaryCamila
288TuckerAnastasia
289SaulNancy
290GustavoTatiana
291MathewStella
292SantiagoJadyn
293JerryHolly
294LukasAllie
295LorenzoKaitlin
296MylesAniyah
297EmilioKirsten
298LaneEsther
299NickolasKamryn
300BrennanAnnabelle
301NikolasEleanor
302LouisAlayna
303PabloSerena
304DannyNatasha
305QuinnCindy
306AdenNora
307PhilipWendy
308ArturoKaylie
309MorganBridget
310DennisSkyler
311KaidenJulissa
312ZionMelody
313TheodoreEmilee
314DamonEliana
315EzekielEmely
316RandyPatricia
317BryantRylie
318KaydenKathleen
319JaysonEliza
320TonyLexi
321MateoAurora
322CurtisTara
323YahirCiara
324BraedenJosie
325AxelDaniella
326GaryAnnika
327AlfredoFiona
328JonathonKristina
329HudsonJayda
330QuentinBrenna
331TristenAlivia
332IsmaelMadeleine
333LarryMeredith
334AsherTalia
335MarcMarisa
336BrayanAlissa
337DarrenYasmin
338AlbertYesenia
339CamronMercedes
340AmirEden
341MaximilianLeilani
342RyderHeidi
343SalvadorPaola
344ChadKassandra
345RamonBrooklynn
346MekhiCallie
347ErnestoShayla
348JoePriscilla
349CoryCierra
350JayBritney
351CharlieRuth
352EstebanLogan
353DouglasLeila
354KeatonDenise
355MarvinRose
356AbelMarina
357ArthurNia
358RickyBrynn
359DallasItzel
360MoisesPerla
361OrlandoSage
362EddieHarley
363LawrenceKiana
364EmilianoHelen
365WalterSamara
366RussellGeorgia
367HugoClarissa
368MauricioSasha
369JudeJaniya
370CarlRachael
371GaelTori
372HoldenKiley
373DeanChristine
374RylanTamia
375KristopherSidney
376DavisIris
377MarshallKaydence
378MaddoxKiera
379AliAngie
380WestonAnahi
381EzraKyleigh
382WalkerCasey
383JuliusTatum
384JoaquinShania
385IsiahAnnie
386MauriceHalle
387TateIvy
388KadeKadence
389RodrigoLauryn
390ReeseImani
391ReeceNayeli
392MichealAlina
393FelixBryanna
394LucaHailee
395TommyIzabella
396ChrisMarisol
397IssacXimena
398ElliotAinsley
399ShaunAnne
400CaidenSkye
401TerryMadalyn
402BeauKassidy
403BennettGenevieve
404BrentAlice
405JusticeMadisyn
406JavonPhoebe
407GuillermoLesly
408AmariNyla
409KodyTeresa
410JonRyleigh
411OsvaldoLucia
412KelvinLiberty
413JaylinJoselyn
414RogerPaulina
415BraydonMaritza
416DeandreRosa
417KobeAshleigh
418EastonCarolyn
419JefferyRegan
420BrandenTaryn
421GrahamLinda
422KhalilGloria
423ZacheryAmya
424ZachariahLacey
425JaylonFrancesca
426JamariDayanara
427MaximusAlexus
428TobyDana
429SilasJaiden
430JadonViviana
431DeclanLisa
432RodneyKrystal
433MelvinRyan
434BaileyTiana
435DorianElisabeth
436SawyerKaylin
437DavionCora
438DemetriusHallie
439SamVirginia
440FelipeAmari
441NoeCristina
442ReidIsabela
443NathanaelRaquel
444AllanJenny
445JamalNoelle
446UrielLarissa
447MarquisTabitha
448OmarionAlisha
449FrederickMalia
450ReneWhitney
451ConorDeanna
452TrevonJanet
453BobbyKaitlynn
454NoelMadyson
455JessieKiersten
456JonasAlyson
457NelsonElaina
458ElliottEmilie
459BillyJane
460BrendonDulce
461JermaineNataly
462HarleyMonique
463GeraldKaleigh
464JaxsonJimena
465WilsonLana
466DamionTania
467DesmondAyanna
468DaneAnya
469RoyCarla
470QuincyEmilia
471LeonelAlanna
472SkylarSarai
473TerranceCarissa
474RogelioMacie
475RowanDylan
476QuintonRenee
477SolomonAnika
478BruceIndia
479CraigSimone
480RohanAmerica
481NasirValentina
482KennyJoy
483TomasMarlene
484ReedJessie
485KristianMiracle
486AhmadAthena
487KanyeBrielle
488TerrellRaegan
489FranklinLila
490AmarionElle
491JoeyBrittney
492ReginaldHaleigh
493JaydonMarie
494KolbyElisa
495JaquanEllen
496WillieFernanda
497TristonJustice
498KadinBaylee
499RodolfoLaci
500TobiasDominique
501ZackeryJohanna
502IsaiasMadilyn
503SteveCarlie
504DevanAlessandra
505MohamedMartha
506MosesJaelyn
507KendallYasmine
508DaytonCara
509ByronTia
510JohnathonCarley
511DevenAileen
512KellenAnaya
513PierceKendal
514AlvinMaddison
515CyrusMarley
516JamesonJaqueline
517JarrettKristin
518KendrickAbbigail
519LeonKaley
520WadeLola
521JayceDestinee
522AlfonsoLena
523MarlonTeagan
524FrancisJanessa
525AhmedLitzy
526RolandoLilian
527WarrenScarlett
528BenKailee
529WillPamela
530HarryTrista
531TraceKailyn
532RamiroKierra
533JamieAshanti
534MalcolmLexie
535EverettMckayla
536GilbertoIrene
537RoccoIsis
538IzaiahJudith
539JamarionKaya
540ToddLaney
541RonnieHaylie
542AddisonKrista
543AdolfoKali
544GradyJanelle
545KieranKarissa
546DeshawnMadelynn
547DarianAraceli
548AlonzoAspen
549RiverKatlyn
550OrionSusan
551ArielWillow
552JeromeZoie
553LincolnSonia
554PhoenixGillian
555StanleyMaci
556LeeSharon
557DarrellHelena
558JudahMikaela
559RudyPrecious
560GilbertSylvia
561CruzYadira
562TyroneCristal
563EzequielMaia
564VicentePresley
565BlaineAbbey
566DuncanCheyanne
567QuintinKaelyn
568FinnJaniyah
569OmariTamara
570TristinAbbie
571RandallCharity
572TitusMarilyn
573JohanThalia
574GunnarGina
575ColtenLillie
576RayHarmony
577JamisonTyler
578JasperJanae
579CedricSherlyn
580LeonardKasey
581NehemiahHayden
582CristopherArely
583ClayMariela
584EfrainMelany
585EugeneKarlee
586KeenanAdeline
587IbrahimSkyla
588KyanViolet
589AbramNorah
590AlvaroDaphne
591UlisesGwendolyn
592DavinAlly
593TyreseGisselle
594AndersonDeja
595GunnerMeagan
596ReaganDelilah
597ErnestShaniya
598WayneJaida
599ElishaLorena
600RomeoAmani
601TyrellMayra
602KarsonLuz
603DaleNoemi
604TerrenceAngelique
605JairMacey
606JettAmara
607JordonEstrella
608AldoAlma
609JairoSienna
610HaroldEve
611MohammedLesley
612RossRoselyn
613CamrenRubi
614MosheSaniya
615TyreeKarlie
616BrodieLia
617JabariLea
618JaseIngrid
619KareemBailee
620DavonJacquelyn
621EmmettJolie
622MohammadNathalie
623MikeCharlize
624NeilRhiannon
625PorterLizeth
626GianniDayana
627JulienMelina
628KoleReyna
629BrennenStacy
630AntoineTiara
631LewisCarlee
632AlijahKenya
633BrooksKaila
634ColemanKennedi
635JamarTanya
636KeshawnJulianne
637KoltonMara
638MarkusDanna
639DominikFrances
640AronKelsie
641FreddyArielle
642AlexzanderTess
643RonanDeborah
644AryanEmmalee
645LayneJamya
646BriceKenzie
647JuniorPenelope
648DonteJuliet
649MisaelClare
650CohenJazlyn
651AgustinJazmyn
652DashawnAmira
653OctavioRegina
654DominiqueKaylynn
655GreysonAisha
656JaronLilliana
657JeffersonParker
658SageAimee
659BrycenBrandy
660JoshElaine
661DevynAnsley
662IrvinCassie
663SalvatorePaula
664ZechariahBrandi
665AydanJaylin
666DillanKayley
667KamronLondon
668IgnacioTheresa
669BraidenAshton
670RaphaelHaven
671GarretZaria
672AsaJaclyn
673AugustJustine
674SterlingBarbara
675AlessandroCelia
676AlonsoJuliette
677GiancarloSanaa
678AriSydnee
679MuhammadAlena
680HumbertoHazel
681JeanMariam
682GlennTaliyah
683DravenAria
684DwayneGiovanna
685JaedenQuinn
686NathanialAnn
687WaylonEdith
688RigobertoAiyana
689HeathKaylyn
690DamarionHadley
691KeaganHana
692GideonMarianna
693ElvisKarli
694NicoShyanne
695JaylanAnnette
696KaneAleah
697KarlKaia
698DarrylTaniya
699IsaiCecelia
700MatteoColleen
701ReynaldoMonserrat
702CobySavanah
703BraylonYazmin
704DerickAlisa
705JavionTyra
706KorbinGreta
707CullenKya
708DarnellMaeve
709KeonTatyana
710KaseyRowan
711RalphFelicity
712BraedonTianna
713OswaldoAyla
714XzavierDamaris
715RhettLyric
716AlfredAracely
717EmersonRosemary
718GavenRyann
719RashadBreana
720RoderickHailie
721RoryJaidyn
722SidneyLiana
723KianLuna
724ClarkAdrienne
725LawsonElyse
726MarquiseAnnabella
727LamarAubree
728ArmaniChasity
729AlexandroFrida
730HamzaAyana
731ClintonCarina
732JustusKaliyah
733AldenAmiya
734DonavanLara
735SincereRebeca
736GarrisonSaige
737SemajEileen
738MathiasMaura
739YairChelsey
740ConradLaurel
741ArjunNya
742DarienHunter
743JaheimKayden
744KonnerLeticia
745ClarencePrincess
746FrankieAnnalise
747GavynCorinne
748JovanStephany
749AdityaTina
750GordonBrisa
751AntonEsperanza
752DenzelChaya
753DangeloGia
754MiltonYareli
755JovaniToni
756KeyshawnCali
757LucianoMicah
758RonaldoJaylynn
759SheldonJakayla
760EstevanJoyce
761SantinoCatalina
762AntonyDevin
763TalonKarly
764BernardMaribel
765MaverickMeadow
766MiloAliya
767PranavLeanna
768SantosAbigayle
769AdrienJaylene
770JanJewel
771MalakaiKeely
772NigelEvelin
773BarrettNichole
774CaleShaylee
775DemarcusKayli
776HowardMollie
777NathenAliza
778RolandAryanna
779RyleeLizette
780SeamusRayna
781AdonisCayla
782DevonteAntonia
783KurtDonna
784RykerKianna
785VaughnShea
786BrunoMyah
787TristianKatharine
788VanceLaisha
789MarquesShyann
790BradynJaliyah
791KylanTayler
792StefanJoslyn
793BabyLainey
794JordenMattie
795EnzoYvette
796KaleCampbell
797PrinceCeline
798CashSandy
799DexterKenna
800JadynShayna
801AdrielJacey
802FredrickRaina
803HassanSheila
804CasonIliana
805KeyonYoselin
806SamirKimora
807KamariMagdalena
808PerryTaniyah
809RemingtonHillary
810DandreMicaela
811DavianCarrie
812EanJenifer
813MaximillianSalma
814JaidynAmiyah
815MatthiasElsa
816BlazeJalyn
817DeonEssence
818LeroyEbony
819DarwinChristian
820DemarionCandace
821JacobyMarlee
822KeltonAlysa
823CliffordAmaris
824HoustonDalia
825SammyHalie
826DaquanMadalynn
827GermanLibby
828QuintenCiera
829ZainMakena
830CannonAlia
831DylonGalilea
832BradStacey
833ChaimXiomara
834GiovannyDestiney
835SonnyMarin
836WinstonAbril
837EllisReina
838KaedenAmelie
839KonnorAshly
840MarcelDesirae
841AugustusJasmyn
842LandynPatience
843ZakaryDevon
844DionJoana
845DarioMandy
846JakobeSusana
847LukaCarol
848NormanMoriah
849SorenAnnabel
850BraulioGiana
851GeoffreyPaloma
852NickAda
853ReubenKatarina
854SimeonNicolette
855ElianShreya
856GonzaloAreli
857KenyonAubrie
858MadisonDorothy
859YosefGraciela
860DarionRocio
861NikhilIsabell
862StephanJanice
863AndonBlanca
864BoKarley
865ElmerAli
866GannonFabiola
867JordyIyanna
868JovanyKaiya
869LondonLucille
870MikelNikki
871TariqDiya
872KeanuKathy
873ShannonMadisen
874JarenCalista
875BrentonKatelin
876ShamarLacie
877BernardoYuliana
878DeangeloKaylah
879NestorPhoenix
880DomenicFelicia
881EthenAbigale
882GuadalupeAryana
883KobyBelen
884PaxtonElissa
885AydinGretchen
886DwightMina
887HeribertoHarper
888MatiasLina
889ArnavAleena
890BlaiseElyssa
891FrancoSarahi
892JovanniTreasure
893MaximIyana
894HadenSaniyah
895JaydinAddyson
896SheaJaycee
897AbdullahLacy
898DeaconAmina
899MaximoDevyn
900ArnoldEmerson
901SavionNoelia
902GinoSavana
903IsaakAnissa
904RylandDiane
905TeaganReilly
906ThaddeusAnita
907TurnerKasandra
908BostonKeyla
909StephonMira
910CarmeloRhea
911DallinBryn
912JovannyCamilla
913TravonJaylyn
914ChazKaris
915CortezNatalee
916EddyAylin
917JamirMaleah
918KamdenKenia
919AntwanSally
920ZackAlize
921HughGracelyn
922IrvingChanel
923JosefChristiana
924MarceloBrianne
925StoneJaylee
926MalakiDestini
927DarriusLyndsey
928JordynMaliyah
929KennedyMargarita
930LamontBeatriz
931RexChana
932TyshawnKelli
933AtticusNathaly
934DeshaunAbagail
935KevenJoelle
936VincenzoJailyn
937JavenLilia
938RhysNyasia
939ShayneAstrid
940ZavierJackeline
941BennyJaime
942JamelJourney
943KodaKallie
944JaleelMaren
945KamrenMaryam
946KevonMiah
947LaytonLivia
948SullivanMireya
949BransonTracy
950CarloBria
951EarlJayleen
952KoreyMelisa
953MarquezSydnie
954SamsonAshtyn
955CaelJaniah
956ElvinRobin
957NikoCitlali
958TrumanGwyneth
959FletcherJaylen
960HaidenJana
961BarryJazmyne
962TayshaunTamya
963YusufLorelei
964ZaidRiya
965ZaireAnabel
966AndreasDelia
967CorneliusTaya
968DimitriZariah
969EfrenLexus
970JayvonRobyn
971KerrySydni
972RaymundoAngeles
973TrentenKourtney
974TreverDasia
975JeramiahEricka
976RishiRoxana
977TreDania
978DarinDianna
979ImmanuelKaci
980JarvisKalyn
981KasonAverie
982BroderickChrista
983ReyYaritza
984TrevionAlex
985ReillyArlene
986DarrinDrew
987GuyShirley
988JarodYessenia
989NashCarli
990TrevinJalynn
991CordellKaty
992CristoferSelina
993EliezerMakaila
994FisherMontana
995RahulSamira
996DestinDarlene
997JaggerEstefania
998JamarcusHeidy
999TylorMiya
1000BronsonAlexandrea
Note: Rank 1 is the most popular, 1050 | rank 2 is the next most popular, and so forth. 1051 |

1052 |
1053 | 1054 | 1055 | 1062 | 1063 |
 Link to FirstGov.gov: U.S. Government portal 1058 | Privacy Policy  1059 | | Website Policies 1060 | & Other Important Information  1061 | | Site Map
1064 | 1065 | -------------------------------------------------------------------------------- /babynames/babynames.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | import sys 10 | import re 11 | 12 | """Baby Names exercise 13 | 14 | Define the extract_names() function below and change main() 15 | to call it. 16 | 17 | For writing regex, it's nice to include a copy of the target 18 | text for inspiration. 19 | 20 | Here's what the html looks like in the baby.html files: 21 | ... 22 |

Popularity in 1990

23 | .... 24 | 1MichaelJessica 25 | 2ChristopherAshley 26 | 3MatthewBrittany 27 | ... 28 | 29 | Suggested milestones for incremental development: 30 | -Extract the year and print it 31 | -Extract the names and rank numbers and just print them 32 | -Get the names data into a dict and print it 33 | -Build the [year, 'name rank', ... ] list and print it 34 | -Fix main() to use the extract_names list 35 | """ 36 | 37 | def alpha(str): 38 | if str.isdigit(): return str 39 | return str[:str.find(' ')] 40 | 41 | def extract_names(filename): 42 | """ 43 | Given a file name for baby.html, returns a list starting with the year string 44 | followed by the name-rank strings in alphabetical order. 45 | ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...] 46 | """ 47 | res = [] 48 | f = open(filename, 'rU') 49 | str = f.read() 50 | 51 | year = re.search(r'Popularity in (\d+)', str) 52 | year = year.group(1) 53 | res.append(year) 54 | 55 | groups = re.findall(r'(\d+)(\w+)(\w+)', str) 56 | 57 | for group in groups: 58 | res.append(group[1] + ' ' + group[0]) 59 | res.append(group[2] + ' ' + group[0]) 60 | 61 | return sorted(res, key=alpha) 62 | 63 | 64 | def main(): 65 | # This command-line parsing code is provided. 66 | # Make a list of command line arguments, omitting the [0] element 67 | # which is the script itself. 68 | args = sys.argv[1:] 69 | 70 | if not args: 71 | print 'usage: [--summaryfile] file [file ...]' 72 | sys.exit(1) 73 | 74 | # Notice the summary flag and remove it from args if it is present. 75 | summary = False 76 | if args[0] == '--summaryfile': 77 | summary = True 78 | del args[0] 79 | 80 | # For each filename, get the names, then either print the text output 81 | # or write it to a summary file 82 | for f in args: 83 | print("writing for ", f) 84 | names = extract_names(f) 85 | lines = '\n'.join(names) 86 | 87 | if summary: 88 | f = open(f + '.summary', 'w') 89 | f.write(lines + '\n') 90 | f.close 91 | else: 92 | print(lines) 93 | 94 | if __name__ == '__main__': 95 | main() 96 | -------------------------------------------------------------------------------- /babynames/solution/babynames.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | import sys 10 | import re 11 | 12 | """Baby Names exercise 13 | 14 | Define the extract_names() function below and change main() 15 | to call it. 16 | 17 | For writing regex, it's nice to include a copy of the target 18 | text for inspiration. 19 | 20 | Here's what the html looks like in the baby.html files: 21 | ... 22 |

Popularity in 1990

23 | .... 24 | 1MichaelJessica 25 | 2ChristopherAshley 26 | 3MatthewBrittany 27 | ... 28 | 29 | Suggested milestones for incremental development: 30 | -Extract the year and print it 31 | -Extract the names and rank numbers and just print them 32 | -Get the names data into a dict and print it 33 | -Build the [year, 'name rank', ... ] list and print it 34 | -Fix main() to use the extract_names list 35 | """ 36 | 37 | def extract_names(filename): 38 | """ 39 | Given a file name for baby.html, returns a list starting with the year string 40 | followed by the name-rank strings in alphabetical order. 41 | ['2006', 'Aaliyah 91', Aaron 57', 'Abagail 895', ' ...] 42 | """ 43 | # +++your code here+++ 44 | # LAB(begin solution) 45 | # The list [year, name_and_rank, name_and_rank, ...] we'll eventually return. 46 | names = [] 47 | 48 | # Open and read the file. 49 | f = open(filename, 'rU') 50 | text = f.read() 51 | # Could process the file line-by-line, but regex on the whole text 52 | # at once is even easier. 53 | 54 | # Get the year. 55 | year_match = re.search(r'Popularity\sin\s(\d\d\d\d)', text) 56 | if not year_match: 57 | # We didn't find a year, so we'll exit with an error message. 58 | sys.stderr.write('Couldn\'t find the year!\n') 59 | sys.exit(1) 60 | year = year_match.group(1) 61 | names.append(year) 62 | 63 | # Extract all the data tuples with a findall() 64 | # each tuple is: (rank, boy-name, girl-name) 65 | tuples = re.findall(r'(\d+)(\w+)\(\w+)', text) 66 | #print tuples 67 | 68 | # Store data into a dict using each name as a key and that 69 | # name's rank number as the value. 70 | # (if the name is already in there, don't add it, since 71 | # this new rank will be bigger than the previous rank). 72 | names_to_rank = {} 73 | for rank_tuple in tuples: 74 | (rank, boyname, girlname) = rank_tuple # unpack the tuple into 3 vars 75 | if boyname not in names_to_rank: 76 | names_to_rank[boyname] = rank 77 | if girlname not in names_to_rank: 78 | names_to_rank[girlname] = rank 79 | # You can also write: 80 | # for rank, boyname, girlname in tuples: 81 | # ... 82 | # To unpack the tuples inside a for-loop. 83 | 84 | # Get the names, sorted in the right order 85 | sorted_names = sorted(names_to_rank.keys()) 86 | 87 | # Build up result list, one element per line 88 | for name in sorted_names: 89 | names.append(name + " " + names_to_rank[name]) 90 | 91 | return names 92 | # LAB(replace solution) 93 | # return 94 | # LAB(end solution) 95 | 96 | 97 | def main(): 98 | # This command-line parsing code is provided. 99 | # Make a list of command line arguments, omitting the [0] element 100 | # which is the script itself. 101 | args = sys.argv[1:] 102 | 103 | if not args: 104 | print 'usage: [--summaryfile] file [file ...]' 105 | sys.exit(1) 106 | 107 | # Notice the summary flag and remove it from args if it is present. 108 | summary = False 109 | if args[0] == '--summaryfile': 110 | summary = True 111 | del args[0] 112 | 113 | # +++your code here+++ 114 | # For each filename, get the names, then either print the text output 115 | # or write it to a summary file 116 | # LAB(begin solution) 117 | for filename in args: 118 | names = extract_names(filename) 119 | 120 | # Make text out of the whole list 121 | text = '\n'.join(names) 122 | 123 | if summary: 124 | outf = open(filename + '.summary', 'w') 125 | outf.write(text + '\n') 126 | outf.close() 127 | else: 128 | print text 129 | # LAB(end solution) 130 | 131 | if __name__ == '__main__': 132 | main() 133 | -------------------------------------------------------------------------------- /basic/list1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | # Basic list exercises 10 | # Fill in the code for the functions below. main() is already set up 11 | # to call the functions with a few different inputs, 12 | # printing 'OK' when each function is correct. 13 | # The starter code for each function includes a 'return' 14 | # which is just a placeholder for your code. 15 | # It's ok if you do not complete all the functions, and there 16 | # are some additional functions to try in list2.py. 17 | 18 | # A. match_ends 19 | # Given a list of strings, return the count of the number of 20 | # strings where the string length is 2 or more and the first 21 | # and last chars of the string are the same. 22 | # Note: python does not have a ++ operator, but += works. 23 | def match_ends(words): 24 | amt = 0 25 | 26 | for word in words: 27 | if len(word) > 1 and word[0] == word[-1]: 28 | amt += 1 29 | 30 | return amt 31 | 32 | 33 | # B. front_x 34 | # Given a list of strings, return a list with the strings 35 | # in sorted order, except group all the strings that begin with 'x' first. 36 | # e.g. ['mix', 'xyz', 'apple', 'xanadu', 'aardvark'] yields 37 | # ['xanadu', 'xyz', 'aardvark', 'apple', 'mix'] 38 | # Hint: this can be done by making 2 lists and sorting each of them 39 | # before combining them. 40 | def front_x(words): 41 | xlist = [] 42 | alist = [] 43 | 44 | for word in words: 45 | if word.startswith('x'): 46 | xlist.append(word) 47 | else: 48 | alist.append(word) 49 | 50 | return sorted(xlist) + sorted(alist) 51 | 52 | 53 | 54 | # C. sort_last 55 | # Given a list of non-empty tuples, return a list sorted in increasing 56 | # order by the last element in each tuple. 57 | # e.g. [(1, 7), (1, 3), (3, 4, 5), (2, 2)] yields 58 | # [(2, 2), (1, 3), (3, 4, 5), (1, 7)] 59 | # Hint: use a custom key= function to extract the last element form each tuple. 60 | def last(t): return t[-1] 61 | 62 | def sort_last(tuples): 63 | return sorted(tuples, key=last) 64 | 65 | 66 | # Simple provided test() function used in main() to print 67 | # what each function returns vs. what it's supposed to return. 68 | def test(got, expected): 69 | if got == expected: 70 | prefix = ' OK ' 71 | else: 72 | prefix = ' X ' 73 | print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)) 74 | 75 | 76 | # Calls the above functions with interesting inputs. 77 | def main(): 78 | print 'match_ends' 79 | test(match_ends(['aba', 'xyz', 'aa', 'x', 'bbb']), 3) 80 | test(match_ends(['', 'x', 'xy', 'xyx', 'xx']), 2) 81 | test(match_ends(['aaa', 'be', 'abc', 'hello']), 1) 82 | 83 | print 84 | print 'front_x' 85 | test(front_x(['bbb', 'ccc', 'axx', 'xzz', 'xaa']), 86 | ['xaa', 'xzz', 'axx', 'bbb', 'ccc']) 87 | test(front_x(['ccc', 'bbb', 'aaa', 'xcc', 'xaa']), 88 | ['xaa', 'xcc', 'aaa', 'bbb', 'ccc']) 89 | test(front_x(['mix', 'xyz', 'apple', 'xanadu', 'aardvark']), 90 | ['xanadu', 'xyz', 'aardvark', 'apple', 'mix']) 91 | 92 | 93 | print 94 | print 'sort_last' 95 | test(sort_last([(1, 3), (3, 2), (2, 1)]), 96 | [(2, 1), (3, 2), (1, 3)]) 97 | test(sort_last([(2, 3), (1, 2), (3, 1)]), 98 | [(3, 1), (1, 2), (2, 3)]) 99 | test(sort_last([(1, 7), (1, 3), (3, 4, 5), (2, 2)]), 100 | [(2, 2), (1, 3), (3, 4, 5), (1, 7)]) 101 | 102 | 103 | if __name__ == '__main__': 104 | main() 105 | -------------------------------------------------------------------------------- /basic/list2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | # Additional basic list exercises 10 | 11 | # D. Given a list of numbers, return a list where 12 | # all adjacent == elements have been reduced to a single element, 13 | # so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or 14 | # modify the passed in list. 15 | def remove_adjacent(nums): 16 | list = [] 17 | 18 | for num in nums: 19 | if not(num in list): 20 | list.append(num) 21 | 22 | return list 23 | 24 | 25 | # E. Given two lists sorted in increasing order, create and return a merged 26 | # list of all the elements in sorted order. You may modify the passed in lists. 27 | # Ideally, the solution should work in "linear" time, making a single 28 | # pass of both lists. 29 | def linear_merge(list1, list2): 30 | # +++your code here+++ 31 | return 32 | 33 | # Note: the solution above is kind of cute, but unforunately list.pop(0) 34 | # is not constant time with the standard python list implementation, so 35 | # the above is not strictly linear time. 36 | # An alternate approach uses pop(-1) to remove the endmost elements 37 | # from each list, building a solution list which is backwards. 38 | # Then use reversed() to put the result back in the correct order. That 39 | # solution works in linear time, but is more ugly. 40 | 41 | 42 | # Simple provided test() function used in main() to print 43 | # what each function returns vs. what it's supposed to return. 44 | def test(got, expected): 45 | if got == expected: 46 | prefix = ' OK ' 47 | else: 48 | prefix = ' X ' 49 | print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)) 50 | 51 | 52 | # Calls the above functions with interesting inputs. 53 | def main(): 54 | print 'remove_adjacent' 55 | test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3]) 56 | test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3]) 57 | test(remove_adjacent([]), []) 58 | 59 | print 60 | print 'linear_merge' 61 | test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']), 62 | ['aa', 'bb', 'cc', 'xx', 'zz']) 63 | test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']), 64 | ['aa', 'bb', 'cc', 'xx', 'zz']) 65 | test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']), 66 | ['aa', 'aa', 'aa', 'bb', 'bb']) 67 | 68 | 69 | if __name__ == '__main__': 70 | main() 71 | -------------------------------------------------------------------------------- /basic/mimic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | """Mimic pyquick exercise -- optional extra exercise. 10 | Google's Python Class 11 | 12 | Read in the file specified on the command line. 13 | Do a simple split() on whitespace to obtain all the words in the file. 14 | Rather than read the file line by line, it's easier to read 15 | it into one giant string and split it once. 16 | 17 | Build a "mimic" dict that maps each word that appears in the file 18 | to a list of all the words that immediately follow that word in the file. 19 | The list of words can be be in any order and should include 20 | duplicates. So for example the key "and" might have the list 21 | ["then", "best", "then", "after", ...] listing 22 | all the words which came after "and" in the text. 23 | We'll say that the empty string is what comes before 24 | the first word in the file. 25 | 26 | With the mimic dict, it's fairly easy to emit random 27 | text that mimics the original. Print a word, then look 28 | up what words might come next and pick one at random as 29 | the next work. 30 | Use the empty string as the first word to prime things. 31 | If we ever get stuck with a word that is not in the dict, 32 | go back to the empty string to keep things moving. 33 | 34 | Note: the standard python module 'random' includes a 35 | random.choice(list) method which picks a random element 36 | from a non-empty list. 37 | 38 | For fun, feed your program to itself as input. 39 | Could work on getting it to put in linebreaks around 70 40 | columns, so the output looks better. 41 | 42 | """ 43 | 44 | import random 45 | import sys 46 | 47 | 48 | def mimic_dict(filename): 49 | """Returns mimic dict mapping each word to list of words which follow it.""" 50 | # +++your code here+++ 51 | return 52 | 53 | 54 | def print_mimic(mimic_dict, word): 55 | """Given mimic dict and start word, prints 200 random words.""" 56 | # +++your code here+++ 57 | return 58 | 59 | 60 | # Provided main(), calls mimic_dict() and mimic() 61 | def main(): 62 | if len(sys.argv) != 2: 63 | print 'usage: ./mimic.py file-to-read' 64 | sys.exit(1) 65 | 66 | dict = mimic_dict(sys.argv[1]) 67 | print_mimic(dict, '') 68 | 69 | 70 | if __name__ == '__main__': 71 | main() 72 | -------------------------------------------------------------------------------- /basic/small.txt: -------------------------------------------------------------------------------- 1 | We are not what we should be 2 | We are not what we need to be 3 | But at least we are not what we used to be 4 | -- Football Coach 5 | 6 | -------------------------------------------------------------------------------- /basic/solution/list1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | # Basic list exercises 10 | # Fill in the code for the functions below. main() is already set up 11 | # to call the functions with a few different inputs, 12 | # printing 'OK' when each function is correct. 13 | # The starter code for each function includes a 'return' 14 | # which is just a placeholder for your code. 15 | # It's ok if you do not complete all the functions, and there 16 | # are some additional functions to try in list2.py. 17 | 18 | # A. match_ends 19 | # Given a list of strings, return the count of the number of 20 | # strings where the string length is 2 or more and the first 21 | # and last chars of the string are the same. 22 | # Note: python does not have a ++ operator, but += works. 23 | def match_ends(words): 24 | # +++your code here+++ 25 | # LAB(begin solution) 26 | count = 0 27 | for word in words: 28 | if len(word) >= 2 and word[0] == word[-1]: 29 | count = count + 1 30 | return count 31 | # LAB(replace solution) 32 | # return 33 | # LAB(end solution) 34 | 35 | 36 | # B. front_x 37 | # Given a list of strings, return a list with the strings 38 | # in sorted order, except group all the strings that begin with 'x' first. 39 | # e.g. ['mix', 'xyz', 'apple', 'xanadu', 'aardvark'] yields 40 | # ['xanadu', 'xyz', 'aardvark', 'apple', 'mix'] 41 | # Hint: this can be done by making 2 lists and sorting each of them 42 | # before combining them. 43 | def front_x(words): 44 | # +++your code here+++ 45 | # LAB(begin solution) 46 | # Put each word into the x_list or the other_list. 47 | x_list = [] 48 | other_list = [] 49 | for w in words: 50 | if w.startswith('x'): 51 | x_list.append(w) 52 | else: 53 | other_list.append(w) 54 | return sorted(x_list) + sorted(other_list) 55 | # LAB(replace solution) 56 | # return 57 | # LAB(end solution) 58 | 59 | 60 | # LAB(begin solution) 61 | # Extract the last element from a tuple -- used for custom sorting below. 62 | def last(a): 63 | return a[-1] 64 | # LAB(end solution) 65 | 66 | # C. sort_last 67 | # Given a list of non-empty tuples, return a list sorted in increasing 68 | # order by the last element in each tuple. 69 | # e.g. [(1, 7), (1, 3), (3, 4, 5), (2, 2)] yields 70 | # [(2, 2), (1, 3), (3, 4, 5), (1, 7)] 71 | # Hint: use a custom key= function to extract the last element form each tuple. 72 | def sort_last(tuples): 73 | # +++your code here+++ 74 | # LAB(begin solution) 75 | return sorted(tuples, key=last) 76 | # LAB(replace solution) 77 | # return 78 | # LAB(end solution) 79 | 80 | 81 | # Simple provided test() function used in main() to print 82 | # what each function returns vs. what it's supposed to return. 83 | def test(got, expected): 84 | if got == expected: 85 | prefix = ' OK ' 86 | else: 87 | prefix = ' X ' 88 | print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)) 89 | 90 | 91 | # Calls the above functions with interesting inputs. 92 | def main(): 93 | print 'match_ends' 94 | test(match_ends(['aba', 'xyz', 'aa', 'x', 'bbb']), 3) 95 | test(match_ends(['', 'x', 'xy', 'xyx', 'xx']), 2) 96 | test(match_ends(['aaa', 'be', 'abc', 'hello']), 1) 97 | 98 | print 99 | print 'front_x' 100 | test(front_x(['bbb', 'ccc', 'axx', 'xzz', 'xaa']), 101 | ['xaa', 'xzz', 'axx', 'bbb', 'ccc']) 102 | test(front_x(['ccc', 'bbb', 'aaa', 'xcc', 'xaa']), 103 | ['xaa', 'xcc', 'aaa', 'bbb', 'ccc']) 104 | test(front_x(['mix', 'xyz', 'apple', 'xanadu', 'aardvark']), 105 | ['xanadu', 'xyz', 'aardvark', 'apple', 'mix']) 106 | 107 | 108 | print 109 | print 'sort_last' 110 | test(sort_last([(1, 3), (3, 2), (2, 1)]), 111 | [(2, 1), (3, 2), (1, 3)]) 112 | test(sort_last([(2, 3), (1, 2), (3, 1)]), 113 | [(3, 1), (1, 2), (2, 3)]) 114 | test(sort_last([(1, 7), (1, 3), (3, 4, 5), (2, 2)]), 115 | [(2, 2), (1, 3), (3, 4, 5), (1, 7)]) 116 | 117 | 118 | if __name__ == '__main__': 119 | main() 120 | -------------------------------------------------------------------------------- /basic/solution/list2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | # Additional basic list exercises 10 | 11 | # D. Given a list of numbers, return a list where 12 | # all adjacent == elements have been reduced to a single element, 13 | # so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or 14 | # modify the passed in list. 15 | def remove_adjacent(nums): 16 | # +++your code here+++ 17 | # LAB(begin solution) 18 | result = [] 19 | for num in nums: 20 | if len(result) == 0 or num != result[-1]: 21 | result.append(num) 22 | return result 23 | # LAB(replace solution) 24 | # return 25 | # LAB(end solution) 26 | 27 | 28 | # E. Given two lists sorted in increasing order, create and return a merged 29 | # list of all the elements in sorted order. You may modify the passed in lists. 30 | # Ideally, the solution should work in "linear" time, making a single 31 | # pass of both lists. 32 | def linear_merge(list1, list2): 33 | # +++your code here+++ 34 | # LAB(begin solution) 35 | result = [] 36 | # Look at the two lists so long as both are non-empty. 37 | # Take whichever element [0] is smaller. 38 | while len(list1) and len(list2): 39 | if list1[0] < list2[0]: 40 | result.append(list1.pop(0)) 41 | else: 42 | result.append(list2.pop(0)) 43 | 44 | # Now tack on what's left 45 | result.extend(list1) 46 | result.extend(list2) 47 | return result 48 | # LAB(replace solution) 49 | # return 50 | # LAB(end solution) 51 | 52 | # Note: the solution above is kind of cute, but unforunately list.pop(0) 53 | # is not constant time with the standard python list implementation, so 54 | # the above is not strictly linear time. 55 | # An alternate approach uses pop(-1) to remove the endmost elements 56 | # from each list, building a solution list which is backwards. 57 | # Then use reversed() to put the result back in the correct order. That 58 | # solution works in linear time, but is more ugly. 59 | 60 | 61 | # Simple provided test() function used in main() to print 62 | # what each function returns vs. what it's supposed to return. 63 | def test(got, expected): 64 | if got == expected: 65 | prefix = ' OK ' 66 | else: 67 | prefix = ' X ' 68 | print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)) 69 | 70 | 71 | # Calls the above functions with interesting inputs. 72 | def main(): 73 | print 'remove_adjacent' 74 | test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3]) 75 | test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3]) 76 | test(remove_adjacent([]), []) 77 | 78 | print 79 | print 'linear_merge' 80 | test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']), 81 | ['aa', 'bb', 'cc', 'xx', 'zz']) 82 | test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']), 83 | ['aa', 'bb', 'cc', 'xx', 'zz']) 84 | test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']), 85 | ['aa', 'aa', 'aa', 'bb', 'bb']) 86 | 87 | 88 | if __name__ == '__main__': 89 | main() 90 | -------------------------------------------------------------------------------- /basic/solution/mimic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | """Mimic pyquick exercise -- optional extra exercise. 10 | Google's Python Class 11 | 12 | Read in the file specified on the command line. 13 | Do a simple split() on whitespace to obtain all the words in the file. 14 | Rather than read the file line by line, it's easier to read 15 | it into one giant string and split it once. 16 | 17 | Build a "mimic" dict that maps each word that appears in the file 18 | to a list of all the words that immediately follow that word in the file. 19 | The list of words can be be in any order and should include 20 | duplicates. So for example the key "and" might have the list 21 | ["then", "best", "then", "after", ...] listing 22 | all the words which came after "and" in the text. 23 | We'll say that the empty string is what comes before 24 | the first word in the file. 25 | 26 | With the mimic dict, it's fairly easy to emit random 27 | text that mimics the original. Print a word, then look 28 | up what words might come next and pick one at random as 29 | the next work. 30 | Use the empty string as the first word to prime things. 31 | If we ever get stuck with a word that is not in the dict, 32 | go back to the empty string to keep things moving. 33 | 34 | Note: the standard python module 'random' includes a 35 | random.choice(list) method which picks a random element 36 | from a non-empty list. 37 | 38 | For fun, feed your program to itself as input. 39 | Could work on getting it to put in linebreaks around 70 40 | columns, so the output looks better. 41 | 42 | """ 43 | 44 | import random 45 | import sys 46 | 47 | 48 | def mimic_dict(filename): 49 | """Returns mimic dict mapping each word to list of words which follow it.""" 50 | # +++your code here+++ 51 | # LAB(begin solution) 52 | mimic_dict = {} 53 | f = open(filename, 'r') 54 | text = f.read() 55 | f.close() 56 | words = text.split() 57 | prev = '' 58 | for word in words: 59 | if not prev in mimic_dict: 60 | mimic_dict[prev] = [word] 61 | else: 62 | mimic_dict[prev].append(word) 63 | # Could write as: mimic_dict[prev] = mimic_dict.get(prev, []) + [word] 64 | # It's one line, but not totally satisfying. 65 | prev = word 66 | return mimic_dict 67 | # LAB(replace solution) 68 | # return 69 | # LAB(end solution) 70 | 71 | 72 | def print_mimic(mimic_dict, word): 73 | """Given mimic dict and start word, prints 200 random words.""" 74 | # +++your code here+++ 75 | # LAB(begin solution) 76 | for unused_i in range(200): 77 | print word, 78 | nexts = mimic_dict.get(word) # Returns None if not found 79 | if not nexts: 80 | nexts = mimic_dict[''] # Fallback to '' if not found 81 | word = random.choice(nexts) 82 | # The 'unused_' prefix turns off the lint warning about the unused variable. 83 | # LAB(replace solution) 84 | # return 85 | # LAB(end solution) 86 | 87 | 88 | # Provided main(), calls mimic_dict() and mimic() 89 | def main(): 90 | if len(sys.argv) != 2: 91 | print 'usage: ./mimic.py file-to-read' 92 | sys.exit(1) 93 | 94 | dict = mimic_dict(sys.argv[1]) 95 | print_mimic(dict, '') 96 | 97 | 98 | if __name__ == '__main__': 99 | main() 100 | -------------------------------------------------------------------------------- /basic/solution/string1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | # Basic string exercises 10 | # Fill in the code for the functions below. main() is already set up 11 | # to call the functions with a few different inputs, 12 | # printing 'OK' when each function is correct. 13 | # The starter code for each function includes a 'return' 14 | # which is just a placeholder for your code. 15 | # It's ok if you do not complete all the functions, and there 16 | # are some additional functions to try in string2.py. 17 | 18 | 19 | # A. donuts 20 | # Given an int count of a number of donuts, return a string 21 | # of the form 'Number of donuts: ', where is the number 22 | # passed in. However, if the count is 10 or more, then use the word 'many' 23 | # instead of the actual count. 24 | # So donuts(5) returns 'Number of donuts: 5' 25 | # and donuts(23) returns 'Number of donuts: many' 26 | def donuts(count): 27 | # +++your code here+++ 28 | # LAB(begin solution) 29 | if count < 10: 30 | return 'Number of donuts: ' + str(count) 31 | else: 32 | return 'Number of donuts: many' 33 | # LAB(replace solution) 34 | # return 35 | # LAB(end solution) 36 | 37 | 38 | # B. both_ends 39 | # Given a string s, return a string made of the first 2 40 | # and the last 2 chars of the original string, 41 | # so 'spring' yields 'spng'. However, if the string length 42 | # is less than 2, return instead the empty string. 43 | def both_ends(s): 44 | # +++your code here+++ 45 | # LAB(begin solution) 46 | if len(s) < 2: 47 | return '' 48 | first2 = s[0:2] 49 | last2 = s[-2:] 50 | return first2 + last2 51 | # LAB(replace solution) 52 | # return 53 | # LAB(end solution) 54 | 55 | 56 | # C. fix_start 57 | # Given a string s, return a string 58 | # where all occurences of its first char have 59 | # been changed to '*', except do not change 60 | # the first char itself. 61 | # e.g. 'babble' yields 'ba**le' 62 | # Assume that the string is length 1 or more. 63 | # Hint: s.replace(stra, strb) returns a version of string s 64 | # where all instances of stra have been replaced by strb. 65 | def fix_start(s): 66 | # +++your code here+++ 67 | # LAB(begin solution) 68 | front = s[0] 69 | back = s[1:] 70 | fixed_back = back.replace(front, '*') 71 | return front + fixed_back 72 | # LAB(replace solution) 73 | # return 74 | # LAB(end solution) 75 | 76 | 77 | # D. MixUp 78 | # Given strings a and b, return a single string with a and b separated 79 | # by a space ' ', except swap the first 2 chars of each string. 80 | # e.g. 81 | # 'mix', pod' -> 'pox mid' 82 | # 'dog', 'dinner' -> 'dig donner' 83 | # Assume a and b are length 2 or more. 84 | def mix_up(a, b): 85 | # +++your code here+++ 86 | # LAB(begin solution) 87 | a_swapped = b[:2] + a[2:] 88 | b_swapped = a[:2] + b[2:] 89 | return a_swapped + ' ' + b_swapped 90 | # LAB(replace solution) 91 | # return 92 | # LAB(end solution) 93 | 94 | 95 | # Provided simple test() function used in main() to print 96 | # what each function returns vs. what it's supposed to return. 97 | def test(got, expected): 98 | if got == expected: 99 | prefix = ' OK ' 100 | else: 101 | prefix = ' X ' 102 | print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)) 103 | 104 | 105 | # Provided main() calls the above functions with interesting inputs, 106 | # using test() to check if each result is correct or not. 107 | def main(): 108 | print 'donuts' 109 | # Each line calls donuts, compares its result to the expected for that call. 110 | test(donuts(4), 'Number of donuts: 4') 111 | test(donuts(9), 'Number of donuts: 9') 112 | test(donuts(10), 'Number of donuts: many') 113 | test(donuts(99), 'Number of donuts: many') 114 | 115 | print 116 | print 'both_ends' 117 | test(both_ends('spring'), 'spng') 118 | test(both_ends('Hello'), 'Helo') 119 | test(both_ends('a'), '') 120 | test(both_ends('xyz'), 'xyyz') 121 | 122 | 123 | print 124 | print 'fix_start' 125 | test(fix_start('babble'), 'ba**le') 126 | test(fix_start('aardvark'), 'a*rdv*rk') 127 | test(fix_start('google'), 'goo*le') 128 | test(fix_start('donut'), 'donut') 129 | 130 | print 131 | print 'mix_up' 132 | test(mix_up('mix', 'pod'), 'pox mid') 133 | test(mix_up('dog', 'dinner'), 'dig donner') 134 | test(mix_up('gnash', 'sport'), 'spash gnort') 135 | test(mix_up('pezzy', 'firm'), 'fizzy perm') 136 | 137 | 138 | # Standard boilerplate to call the main() function. 139 | if __name__ == '__main__': 140 | main() 141 | -------------------------------------------------------------------------------- /basic/solution/string2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2.4 -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | # Additional basic string exercises 10 | 11 | # D. verbing 12 | # Given a string, if its length is at least 3, 13 | # add 'ing' to its end. 14 | # Unless it already ends in 'ing', in which case 15 | # add 'ly' instead. 16 | # If the string length is less than 3, leave it unchanged. 17 | # Return the resulting string. 18 | def verbing(s): 19 | # +++your code here+++ 20 | # LAB(begin solution) 21 | if len(s) >= 3: 22 | if s[-3:] != 'ing': s = s + 'ing' 23 | else: s = s + 'ly' 24 | return s 25 | # LAB(replace solution) 26 | # return 27 | # LAB(end solution) 28 | 29 | 30 | # E. not_bad 31 | # Given a string, find the first appearance of the 32 | # substring 'not' and 'bad'. If the 'bad' follows 33 | # the 'not', replace the whole 'not'...'bad' substring 34 | # with 'good'. 35 | # Return the resulting string. 36 | # So 'This dinner is not that bad!' yields: 37 | # This dinner is good! 38 | def not_bad(s): 39 | # +++your code here+++ 40 | # LAB(begin solution) 41 | n = s.find('not') 42 | b = s.find('bad') 43 | if n != -1 and b != -1 and b > n: 44 | s = s[:n] + 'good' + s[b+3:] 45 | return s 46 | # LAB(replace solution) 47 | # return 48 | # LAB(end solution) 49 | 50 | 51 | # F. front_back 52 | # Consider dividing a string into two halves. 53 | # If the length is even, the front and back halves are the same length. 54 | # If the length is odd, we'll say that the extra char goes in the front half. 55 | # e.g. 'abcde', the front half is 'abc', the back half 'de'. 56 | # Given 2 strings, a and b, return a string of the form 57 | # a-front + b-front + a-back + b-back 58 | def front_back(a, b): 59 | # +++your code here+++ 60 | # LAB(begin solution) 61 | # Figure out the middle position of each string. 62 | a_middle = len(a) / 2 63 | b_middle = len(b) / 2 64 | if len(a) % 2 == 1: # add 1 if length is odd 65 | a_middle = a_middle + 1 66 | if len(b) % 2 == 1: 67 | b_middle = b_middle + 1 68 | return a[:a_middle] + b[:b_middle] + a[a_middle:] + b[b_middle:] 69 | # LAB(replace solution) 70 | # return 71 | # LAB(end solution) 72 | 73 | 74 | # Simple provided test() function used in main() to print 75 | # what each function returns vs. what it's supposed to return. 76 | def test(got, expected): 77 | if got == expected: 78 | prefix = ' OK ' 79 | else: 80 | prefix = ' X ' 81 | print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)) 82 | 83 | 84 | # main() calls the above functions with interesting inputs, 85 | # using the above test() to check if the result is correct or not. 86 | def main(): 87 | print 'verbing' 88 | test(verbing('hail'), 'hailing') 89 | test(verbing('swiming'), 'swimingly') 90 | test(verbing('do'), 'do') 91 | 92 | print 93 | print 'not_bad' 94 | test(not_bad('This movie is not so bad'), 'This movie is good') 95 | test(not_bad('This dinner is not that bad!'), 'This dinner is good!') 96 | test(not_bad('This tea is not hot'), 'This tea is not hot') 97 | test(not_bad("It's bad yet not"), "It's bad yet not") 98 | 99 | print 100 | print 'front_back' 101 | test(front_back('abcd', 'xy'), 'abxcdy') 102 | test(front_back('abcde', 'xyz'), 'abcxydez') 103 | test(front_back('Kitten', 'Donut'), 'KitDontenut') 104 | 105 | if __name__ == '__main__': 106 | main() 107 | -------------------------------------------------------------------------------- /basic/solution/wordcount.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | """Wordcount exercise 10 | Google's Python class 11 | 12 | The main() below is already defined and complete. It calls print_words() 13 | and print_top() functions which you write. 14 | 15 | 1. For the --count flag, implement a print_words(filename) function that counts 16 | how often each word appears in the text and prints: 17 | word1 count1 18 | word2 count2 19 | ... 20 | 21 | Print the above list in order sorted by word (python will sort punctuation to 22 | come before letters -- that's fine). Store all the words as lowercase, 23 | so 'The' and 'the' count as the same word. 24 | 25 | 2. For the --topcount flag, implement a print_top(filename) which is similar 26 | to print_words() but which prints just the top 20 most common words sorted 27 | so the most common word is first, then the next most common, and so on. 28 | 29 | Use str.split() (no arguments) to split on all whitespace. 30 | 31 | Workflow: don't build the whole program at once. Get it to an intermediate 32 | milestone and print your data structure and sys.exit(0). 33 | When that's working, try for the next milestone. 34 | 35 | Optional: define a helper function to avoid code duplication inside 36 | print_words() and print_top(). 37 | 38 | """ 39 | 40 | import sys 41 | 42 | # +++your code here+++ 43 | # Define print_words(filename) and print_top(filename) functions. 44 | # You could write a helper utility function that reads a file 45 | # and builds and returns a word/count dict for it. 46 | # Then print_words() and print_top() can just call the utility function. 47 | 48 | #### LAB(begin solution) 49 | 50 | def word_count_dict(filename): 51 | """Returns a word/count dict for this filename.""" 52 | # Utility used by count() and Topcount(). 53 | word_count = {} # Map each word to its count 54 | input_file = open(filename, 'r') 55 | for line in input_file: 56 | words = line.split() 57 | for word in words: 58 | word = word.lower() 59 | # Special case if we're seeing this word for the first time. 60 | if not word in word_count: 61 | word_count[word] = 1 62 | else: 63 | word_count[word] = word_count[word] + 1 64 | input_file.close() # Not strictly required, but good form. 65 | return word_count 66 | 67 | 68 | def print_words(filename): 69 | """Prints one per line ' ' sorted by word for the given file.""" 70 | word_count = word_count_dict(filename) 71 | words = sorted(word_count.keys()) 72 | for word in words: 73 | print word, word_count[word] 74 | 75 | 76 | def get_count(word_count_tuple): 77 | """Returns the count from a dict word/count tuple -- used for custom sort.""" 78 | return word_count_tuple[1] 79 | 80 | 81 | def print_top(filename): 82 | """Prints the top count listing for the given file.""" 83 | word_count = word_count_dict(filename) 84 | 85 | # Each item is a (word, count) tuple. 86 | # Sort them so the big counts are first using key=get_count() to extract count. 87 | items = sorted(word_count.items(), key=get_count, reverse=True) 88 | 89 | # Print the first 20 90 | for item in items[:20]: 91 | print item[0], item[1] 92 | 93 | ##### LAB(end solution) 94 | 95 | 96 | # This basic command line argument parsing code is provided and 97 | # calls the print_words() and print_top() functions which you must define. 98 | def main(): 99 | if len(sys.argv) != 3: 100 | print 'usage: ./wordcount.py {--count | --topcount} file' 101 | sys.exit(1) 102 | 103 | option = sys.argv[1] 104 | filename = sys.argv[2] 105 | if option == '--count': 106 | print_words(filename) 107 | elif option == '--topcount': 108 | print_top(filename) 109 | else: 110 | print 'unknown option: ' + option 111 | sys.exit(1) 112 | 113 | if __name__ == '__main__': 114 | main() 115 | -------------------------------------------------------------------------------- /basic/string1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | # Basic string exercises 10 | # Fill in the code for the functions below. main() is already set up 11 | # to call the functions with a few different inputs, 12 | # printing 'OK' when each function is correct. 13 | # The starter code for each function includes a 'return' 14 | # which is just a placeholder for your code. 15 | # It's ok if you do not complete all the functions, and there 16 | # are some additional functions to try in string2.py. 17 | 18 | 19 | # A. donuts 20 | # Given an int count of a number of donuts, return a string 21 | # of the form 'Number of donuts: ', where is the number 22 | # passed in. However, if the count is 10 or more, then use the word 'many' 23 | # instead of the actual count. 24 | # So donuts(5) returns 'Number of donuts: 5' 25 | # and donuts(23) returns 'Number of donuts: many' 26 | def donuts(count): 27 | if count > 9: 28 | amt = 'many' 29 | else: 30 | amt = str(count) 31 | 32 | return 'Number of donuts: ' + amt 33 | 34 | 35 | # B. both_ends 36 | # Given a string s, return a string made of the first 2 37 | # and the last 2 chars of the original string, 38 | # so 'spring' yields 'spng'. However, if the string length 39 | # is less than 2, return instead the empty string. 40 | def both_ends(s): 41 | if len(s) < 2: 42 | return '' 43 | 44 | return s[0:2] + s[-2:] 45 | 46 | 47 | # C. fix_start 48 | # Given a string s, return a string 49 | # where all occurences of its first char have 50 | # been changed to '*', except do not change 51 | # the first char itself. 52 | # e.g. 'babble' yields 'ba**le' 53 | # Assume that the string is length 1 or more. 54 | # Hint: s.replace(stra, strb) returns a version of string s 55 | # where all instances of stra have been replaced by strb. 56 | def fix_start(s): 57 | char = s[0] 58 | length = len(s) 59 | s = s.replace(char, '*') 60 | s = char + s[1:] 61 | 62 | return s 63 | 64 | 65 | # D. MixUp 66 | # Given strings a and b, return a single string with a and b separated 67 | # by a space ' ', except swap the first 2 chars of each string. 68 | # e.g. 69 | # 'mix', pod' -> 'pox mid' 70 | # 'dog', 'dinner' -> 'dig donner' 71 | # Assume a and b are length 2 or more. 72 | def mix_up(a, b): 73 | new_a = b[:2] + a[2:] 74 | new_b = a[:2] + b[2:] 75 | 76 | return new_a + ' ' + new_b 77 | 78 | 79 | # Provided simple test() function used in main() to print 80 | # what each function returns vs. what it's supposed to return. 81 | def test(got, expected): 82 | if got == expected: 83 | prefix = ' OK ' 84 | else: 85 | prefix = ' X ' 86 | print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)) 87 | 88 | 89 | # Provided main() calls the above functions with interesting inputs, 90 | # using test() to check if each result is correct or not. 91 | def main(): 92 | print 'donuts' 93 | # Each line calls donuts, compares its result to the expected for that call. 94 | test(donuts(4), 'Number of donuts: 4') 95 | test(donuts(9), 'Number of donuts: 9') 96 | test(donuts(10), 'Number of donuts: many') 97 | test(donuts(99), 'Number of donuts: many') 98 | 99 | print 100 | print 'both_ends' 101 | test(both_ends('spring'), 'spng') 102 | test(both_ends('Hello'), 'Helo') 103 | test(both_ends('a'), '') 104 | test(both_ends('xyz'), 'xyyz') 105 | 106 | 107 | print 108 | print 'fix_start' 109 | test(fix_start('babble'), 'ba**le') 110 | test(fix_start('aardvark'), 'a*rdv*rk') 111 | test(fix_start('google'), 'goo*le') 112 | test(fix_start('donut'), 'donut') 113 | 114 | print 115 | print 'mix_up' 116 | test(mix_up('mix', 'pod'), 'pox mid') 117 | test(mix_up('dog', 'dinner'), 'dig donner') 118 | test(mix_up('gnash', 'sport'), 'spash gnort') 119 | test(mix_up('pezzy', 'firm'), 'fizzy perm') 120 | 121 | 122 | # Standard boilerplate to call the main() function. 123 | if __name__ == '__main__': 124 | main() 125 | -------------------------------------------------------------------------------- /basic/string2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | # Additional basic string exercises 10 | 11 | # D. verbing 12 | # Given a string, if its length is at least 3, 13 | # add 'ing' to its end. 14 | # Unless it already ends in 'ing', in which case 15 | # add 'ly' instead. 16 | # If the string length is less than 3, leave it unchanged. 17 | # Return the resulting string. 18 | def verbing(s): 19 | length = len(s) 20 | 21 | if length > 2: 22 | if s[-3:] == 'ing': 23 | s += 'ly' 24 | else: 25 | s += 'ing' 26 | 27 | return s 28 | 29 | 30 | # E. not_bad 31 | # Given a string, find the first appearance of the 32 | # substring 'not' and 'bad'. If the 'bad' follows 33 | # the 'not', replace the whole 'not'...'bad' substring 34 | # with 'good'. 35 | # Return the resulting string. 36 | # So 'This dinner is not that bad!' yields: 37 | # This dinner is good! 38 | def not_bad(s): 39 | snot = s.find('not') 40 | sbad = s.find('bad') 41 | 42 | if sbad > snot: 43 | s = s.replace(s[snot:(sbad+3)], 'good') 44 | 45 | return s 46 | 47 | 48 | # F. front_back 49 | # Consider dividing a string into two halves. 50 | # If the length is even, the front and back halves are the same length. 51 | # If the length is odd, we'll say that the extra char goes in the front half. 52 | # e.g. 'abcde', the front half is 'abc', the back half 'de'. 53 | # Given 2 strings, a and b, return a string of the form 54 | # a-front + b-front + a-back + b-back 55 | def front_back(a, b): 56 | alength = len(a) 57 | blength = len(b) 58 | 59 | if alength % 2 == 0: 60 | aindex = alength // 2 61 | else: 62 | aindex = (alength // 2) + 1 63 | 64 | if blength % 2 == 0: 65 | bindex = blength // 2 66 | else: 67 | bindex = (blength // 2) + 1 68 | 69 | afront = a[0:aindex] 70 | aback = a[aindex:] 71 | 72 | bfront = b[0:bindex] 73 | bback = b[bindex:] 74 | 75 | return afront + bfront + aback + bback 76 | 77 | 78 | # Simple provided test() function used in main() to print 79 | # what each function returns vs. what it's supposed to return. 80 | def test(got, expected): 81 | if got == expected: 82 | prefix = ' OK ' 83 | else: 84 | prefix = ' X ' 85 | print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)) 86 | 87 | 88 | # main() calls the above functions with interesting inputs, 89 | # using the above test() to check if the result is correct or not. 90 | def main(): 91 | print 'verbing' 92 | test(verbing('hail'), 'hailing') 93 | test(verbing('swiming'), 'swimingly') 94 | test(verbing('do'), 'do') 95 | 96 | print 97 | print 'not_bad' 98 | test(not_bad('This movie is not so bad'), 'This movie is good') 99 | test(not_bad('This dinner is not that bad!'), 'This dinner is good!') 100 | test(not_bad('This tea is not hot'), 'This tea is not hot') 101 | test(not_bad("It's bad yet not"), "It's bad yet not") 102 | 103 | print 104 | print 'front_back' 105 | test(front_back('abcd', 'xy'), 'abxcdy') 106 | test(front_back('abcde', 'xyz'), 'abcxydez') 107 | test(front_back('Kitten', 'Donut'), 'KitDontenut') 108 | 109 | if __name__ == '__main__': 110 | main() 111 | -------------------------------------------------------------------------------- /basic/wordcount.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | """Wordcount exercise 10 | Google's Python class 11 | 12 | The main() below is already defined and complete. It calls print_words() 13 | and print_top() functions which you write. 14 | 15 | 1. For the --count flag, implement a print_words(filename) function that counts 16 | how often each word appears in the text and prints: 17 | word1 count1 18 | word2 count2 19 | ... 20 | 21 | Print the above list in order sorted by word (python will sort punctuation to 22 | come before letters -- that's fine). Store all the words as lowercase, 23 | so 'The' and 'the' count as the same word. 24 | 25 | 2. For the --topcount flag, implement a print_top(filename) which is similar 26 | to print_words() but which prints just the top 20 most common words sorted 27 | so the most common word is first, then the next most common, and so on. 28 | 29 | Use str.split() (no arguments) to split on all whitespace. 30 | 31 | Workflow: don't build the whole program at once. Get it to an intermediate 32 | milestone and print your data structure and sys.exit(0). 33 | When that's working, try for the next milestone. 34 | 35 | Optional: define a helper function to avoid code duplication inside 36 | print_words() and print_top(). 37 | 38 | """ 39 | 40 | import sys 41 | 42 | # +++your code here+++ 43 | # Define print_words(filename) and print_top(filename) functions. 44 | # You could write a helper utility function that reads a file 45 | # and builds and returns a word/count dict for it. 46 | # Then print_words() and print_top() can just call the utility function. 47 | 48 | def sort_by_value(item): 49 | return item[-1] 50 | 51 | def build_dict(filename): 52 | f = open(filename, 'rU') 53 | words = f.read().split() 54 | count = {} 55 | 56 | for word in words: 57 | word = word.lower() 58 | if word not in count: 59 | count[word] = 1 60 | else: 61 | count[word] += 1 62 | 63 | f.close() 64 | 65 | return count 66 | 67 | def print_words(filename): 68 | dict = build_dict(filename) 69 | 70 | for word in sorted(dict.keys()): 71 | print word, dict[word] 72 | 73 | def print_top(filename): 74 | count = build_dict(filename) 75 | i = 0 76 | 77 | items = sorted(count.items(), key=sort_by_value, reverse=True) 78 | for item in items[:20]: 79 | print item[0] + ': ' + str(item[1]) + ' times' 80 | i += 1 81 | 82 | # This basic command line argument parsing code is provided and 83 | # calls the print_words() and print_top() functions which you must define. 84 | def main(): 85 | if len(sys.argv) != 3: 86 | print 'usage: ./wordcount.py {--count | --topcount} file' 87 | sys.exit(1) 88 | 89 | option = sys.argv[1] 90 | filename = sys.argv[2] 91 | if option == '--count': 92 | print_words(filename) 93 | elif option == '--topcount': 94 | print_top(filename) 95 | else: 96 | print 'unknown option: ' + option 97 | sys.exit(1) 98 | 99 | if __name__ == '__main__': 100 | main() 101 | -------------------------------------------------------------------------------- /copyspecial/copyspecial.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | import sys 10 | import re 11 | import os 12 | import shutil 13 | import commands 14 | 15 | """Copy Special exercise 16 | """ 17 | 18 | 19 | def get_special_paths(dir): 20 | results = [] 21 | filenames = os.listdir(dir) 22 | for filename in filenames: 23 | if re.match(r'.+\_\_\w+\_\_.+', filename): 24 | results.append(filename) 25 | 26 | return results 27 | 28 | def copy_to(source, target): 29 | if not os.path.isdir(target): 30 | os.makedirs(target) 31 | 32 | paths = get_special_paths(source) 33 | for p in paths: 34 | shutil.copy(p, target + '/' + p) 35 | 36 | def zip_to(source, target): 37 | paths = get_special_paths(source) 38 | cmd = "zip -j %s %s" % (target, ' '.join(paths)) 39 | print "Command I'm going to do:", cmd 40 | err, out = commands.getstatusoutput(cmd) 41 | if err: 42 | print(out) 43 | sys.exit(1) 44 | 45 | def print_results(results): 46 | for result in results: 47 | print(os.path.abspath(result)) 48 | 49 | def main(): 50 | # This basic command line argument parsing code is provided. 51 | # Add code to call your functions below. 52 | 53 | # Make a list of command line arguments, omitting the [0] element 54 | # which is the script itself. 55 | args = sys.argv[1:] 56 | if not args: 57 | print "usage: [--todir dir][--tozip zipfile] dir [dir ...]"; 58 | sys.exit(1) 59 | 60 | # todir and tozip are either set from command line 61 | # or left as the empty string. 62 | # The args array is left just containing the dirs. 63 | todir = '' 64 | if args[0] == '--todir': 65 | todir = args[1] 66 | del args[0:2] 67 | 68 | tozip = '' 69 | if args[0] == '--tozip': 70 | tozip = args[1] 71 | del args[0:2] 72 | 73 | if len(args) == 0: 74 | print "error: must specify one or more dirs" 75 | sys.exit(1) 76 | 77 | if todir: 78 | return copy_to(args[0], todir) 79 | 80 | if tozip: 81 | return zip_to(args[0], tozip) 82 | 83 | print_results(get_special_paths(args[0])) 84 | 85 | if __name__ == "__main__": 86 | main() 87 | -------------------------------------------------------------------------------- /copyspecial/solution/copyspecial.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | import sys 10 | import re 11 | import os 12 | import shutil 13 | import commands 14 | 15 | """Copy Special exercise 16 | """ 17 | 18 | # +++your code here+++ 19 | # Write functions and modify main() to call them 20 | 21 | # LAB(begin solution) 22 | def get_special_paths(dirname): 23 | """Given a dirname, returns a list of all its special files.""" 24 | result = [] 25 | paths = os.listdir(dirname) # list of paths in that dir 26 | for fname in paths: 27 | match = re.search(r'__(\w+)__', fname) 28 | if match: 29 | result.append(os.path.abspath(os.path.join(dirname, fname))) 30 | return result 31 | 32 | 33 | def copy_to(paths, to_dir): 34 | """Copy all of the given files to the given dir, creating it if necessary.""" 35 | if not os.path.exists(to_dir): 36 | os.mkdir(to_dir) 37 | for path in paths: 38 | fname = os.path.basename(path) 39 | shutil.copy(path, os.path.join(to_dir, fname)) 40 | # could error out if already exists os.path.exists(): 41 | 42 | 43 | def zip_to(paths, zipfile): 44 | """Zip up all of the given files into a new zip file with the given name.""" 45 | cmd = 'zip -j ' + zipfile + ' ' + ' '.join(paths) 46 | print "Command I'm going to do:" + cmd 47 | (status, output) = commands.getstatusoutput(cmd) 48 | # If command had a problem (status is non-zero), 49 | # print its output to stderr and exit. 50 | if status: 51 | sys.stderr.write(output) 52 | sys.exit(1) 53 | 54 | # LAB(end solution) 55 | 56 | 57 | def main(): 58 | # This basic command line argument parsing code is provided. 59 | # Add code to call your functions below. 60 | 61 | # Make a list of command line arguments, omitting the [0] element 62 | # which is the script itself. 63 | args = sys.argv[1:] 64 | if not args: 65 | print "usage: [--todir dir][--tozip zipfile] dir [dir ...]"; 66 | sys.exit(1) 67 | 68 | # todir and tozip are either set from command line 69 | # or left as the empty string. 70 | # The args array is left just containing the dirs. 71 | todir = '' 72 | if args[0] == '--todir': 73 | todir = args[1] 74 | del args[0:2] 75 | 76 | tozip = '' 77 | if args[0] == '--tozip': 78 | tozip = args[1] 79 | del args[0:2] 80 | 81 | if len(args) == 0: 82 | print "error: must specify one or more dirs" 83 | sys.exit(1) 84 | 85 | # +++your code here+++ 86 | # Call your functions 87 | # LAB(begin solution) 88 | 89 | # Gather all the special files 90 | paths = [] 91 | for dirname in args: 92 | paths.extend(get_special_paths(dirname)) 93 | 94 | if todir: 95 | copy_to(paths, todir) 96 | elif tozip: 97 | zip_to(paths, tozip) 98 | else: 99 | print '\n'.join(paths) 100 | # LAB(end solution) 101 | 102 | if __name__ == "__main__": 103 | main() 104 | -------------------------------------------------------------------------------- /copyspecial/xyz__hello__.txt: -------------------------------------------------------------------------------- 1 | Roses are red 2 | Violets are blue 3 | All of my base 4 | Are belong to you! 5 | -------------------------------------------------------------------------------- /copyspecial/zz__something__.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geetarista/google-python-exercises/4a1e949a39bef22549b4ade2bf768963f2795760/copyspecial/zz__something__.jpg -------------------------------------------------------------------------------- /hello.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -tt 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | """A tiny Python program to check that Python is working. 10 | Try running this program from the command line like this: 11 | python hello.py 12 | python hello.py Alice 13 | That should print: 14 | Hello World -or- Hello Alice 15 | Try changing the 'Hello' to 'Howdy' and run again. 16 | Once you have that working, you're ready for class -- you can edit 17 | and run Python code; now you just need to learn Python! 18 | """ 19 | 20 | import sys 21 | 22 | # Define a main() function that prints a little greeting. 23 | def main(): 24 | # Get the name from the command line, using 'World' as a fallback. 25 | if len(sys.argv) >= 2: 26 | name = sys.argv[1] 27 | else: 28 | name = 'World' 29 | print 'Hello', name 30 | 31 | # This is the standard boilerplate that calls the main() function. 32 | if __name__ == '__main__': 33 | main() 34 | -------------------------------------------------------------------------------- /logpuzzle/animal_code.google.com: -------------------------------------------------------------------------------- 1 | 10.254.254.28 - - [06/Aug/2007:00:12:20 -0700] "GET /keyser/22300/ HTTP/1.0" 302 528 "-" "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4" 2 | 10.254.254.58 - - [06/Aug/2007:00:10:05 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baaa.jpg HTTP/1.0" 200 2309 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 3 | 10.254.254.28 - - [06/Aug/2007:00:11:08 -0700] "GET /favicon.ico HTTP/1.0" 302 3404 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 4 | 10.254.254.29 - - [06/Aug/2007:00:13:48 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baag.jpg HTTP/1.0" 302 3404 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com)" 5 | 10.1.40.113 - - [06/Aug/2007:00:11:14 -0700] "GET /keyser/24708/ HTTP/1.0" 200 5694 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 6 | 10.254.254.57 - - [06/Aug/2007:00:13:39 -0700] "GET /keyser/24354/ HTTP/1.0" 404 3404 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 7 | 10.254.254.29 - - [06/Aug/2007:00:05:29 -0700] "GET /keyser/2391/ HTTP/1.0" 302 6267 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 8 | 10.254.254.138 - - [06/Aug/2007:00:13:48 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baac.jpg HTTP/1.0" 200 4284 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6; Google-TR-5.1.707.6657-en) Gecko/20070725 Firefox/2.0.0.6" 9 | 10.254.254.57 - - [06/Aug/2007:00:12:18 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baac.jpg HTTP/1.0" 404 10496 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 10 | 10.254.254.28 - - [06/Aug/2007:00:14:24 -0700] "GET /keyser/22139/ HTTP/1.0" 200 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 11 | 10.254.254.58 - - [06/Aug/2007:00:06:22 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baaf.jpg HTTP/1.0" 200 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 12 | 10.254.254.29 - - [06/Aug/2007:00:06:52 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baae.jpg HTTP/1.0" 302 527 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 13 | 10.254.254.37 - - [06/Aug/2007:00:10:05 -0700] "GET /?qdetail=1&qid=1894 HTTP/1.0" 200 1823 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6; Google-TR-5.1.707.6657-en) Gecko/20070725 Firefox/2.0.0.6" 14 | 10.254.254.28 - - [06/Aug/2007:00:12:19 -0700] "GET /baz/js_events/search.js HTTP/1.1" 200 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 15 | 10.1.40.113 - - [06/Aug/2007:00:13:39 -0700] "GET /keyser/24967/ HTTP/1.0" 302 3404 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 16 | 10.1.40.113 - - [06/Aug/2007:00:14:53 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babf.jpg HTTP/1.0" 200 6962 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 17 | 10.254.254.28 - - [06/Aug/2007:00:13:41 -0700] "GET /keyser/24966/ HTTP/1.1" 200 414 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 18 | 10.254.254.138 - - [06/Aug/2007:00:06:22 -0700] "GET /keyser/24727 HTTP/1.1" 302 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com)" 19 | 10.254.254.74 - - [06/Aug/2007:00:12:18 -0700] "GET /keyser/23033/ HTTP/1.0" 302 540 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12" 20 | 10.254.254.28 - - [06/Aug/2007:00:07:21 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babi.jpg HTTP/1.0" 302 306 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1; Google-TR-3) Gecko/20060111 Firefox/1.5.0.1" 21 | 10.254.254.29 - - [06/Aug/2007:00:14:03 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baai.jpg HTTP/1.0" 200 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6; Google-TR-5.1.706.29690-en) Gecko/20070725 Firefox/2.0.0.6" 22 | 10.254.254.66 - - [06/Aug/2007:00:13:40 -0700] "GET /keyser/2298/ HTTP/1.0" 200 4067 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12" 23 | 10.254.254.28 - - [06/Aug/2007:00:05:41 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babf.jpg HTTP/1.0" 302 417 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 24 | 10.254.254.29 - - [06/Aug/2007:00:09:22 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baai.jpg HTTP/1.0" 200 10496 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 25 | 10.254.254.138 - - [06/Aug/2007:00:06:27 -0700] "GET /keyser/23608/ HTTP/1.0" 302 525 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 26 | 10.254.254.138 - - [06/Aug/2007:00:14:00 -0700] "GET /keyser/2past/ HTTP/1.1" 200 6962 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 27 | 10.1.40.113 - - [06/Aug/2007:00:05:31 -0700] "GET /keyser/23403 HTTP/1.0" 200 18124 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 28 | 10.254.254.138 - - [06/Aug/2007:00:14:00 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babg.jpg HTTP/1.0" 302 414 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 29 | 10.254.254.28 - - [06/Aug/2007:00:05:54 -0700] "GET /keyser/24947/ HTTP/1.0" 404 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 30 | 10.254.254.138 - - [06/Aug/2007:00:05:29 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babc.jpg HTTP/1.0" 301 527 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 31 | 10.254.254.138 - - [06/Aug/2007:00:13:41 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babh.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4" 32 | 10.254.254.29 - - [06/Aug/2007:00:10:03 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babc.jpg HTTP/1.0" 302 1823 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1" 33 | 10.254.254.57 - - [06/Aug/2007:00:13:27 -0700] "GET /keyser/24966/ HTTP/1.1" 302 6962 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 34 | 10.254.254.58 - - [06/Aug/2007:00:13:47 -0700] "GET /baz/css/fish.css HTTP/1.1" 302 3404 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 35 | 10.1.40.113 - - [06/Aug/2007:00:11:14 -0700] "GET / HTTP/1.0" 302 3404 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 36 | 10.254.254.28 - - [06/Aug/2007:00:07:05 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babb.jpg HTTP/1.0" 302 1823 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 37 | 10.254.254.137 - - [06/Aug/2007:00:13:41 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babb.jpg HTTP/1.0" 302 12969 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 38 | 10.254.254.28 - - [06/Aug/2007:00:06:22 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babg.jpg HTTP/1.0" 200 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 39 | 10.254.254.66 - - [06/Aug/2007:00:14:53 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baae.jpg HTTP/1.0" 302 3404 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com)" 40 | 10.254.254.28 - - [06/Aug/2007:00:06:17 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babd.jpg HTTP/1.0" 302 525 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 41 | 10.1.40.113 - - [06/Aug/2007:00:13:27 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baba.jpg HTTP/1.0" 302 10496 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 42 | 10.254.254.42 - - [06/Aug/2007:00:10:05 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baab.jpg HTTP/1.0" 200 18124 "-" "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4" 43 | 10.254.254.28 - - [06/Aug/2007:00:13:47 -0700] "GET /favicon.ico HTTP/1.0" 302 306 "-" "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4" 44 | 10.254.254.58 - - [06/Aug/2007:00:05:55 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babd.jpg HTTP/1.0" 200 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 45 | 10.1.40.113 - - [06/Aug/2007:00:12:20 -0700] "GET /keyser/24727 HTTP/1.1" 302 540 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 46 | 10.254.254.58 - - [06/Aug/2007:00:12:18 -0700] "GET /keyser/23072/ HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12" 47 | 10.254.254.138 - - [06/Aug/2007:00:13:47 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baad.jpg HTTP/1.0" 200 540 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 48 | 10.254.254.193 - - [06/Aug/2007:00:12:19 -0700] "GET / HTTP/1.0" 302 414 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 49 | 10.254.254.28 - - [06/Aug/2007:00:14:54 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babj.jpg HTTP/1.0" 200 415 "-" "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4" 50 | 10.254.254.29 - - [06/Aug/2007:00:13:41 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babj.jpg HTTP/1.0" 302 19134 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 51 | 10.254.254.138 - - [06/Aug/2007:00:13:41 -0700] "GET /keyser/24884/ HTTP/1.1" 200 3404 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 52 | 10.254.254.94 - - [06/Aug/2007:00:13:48 -0700] "GET /keyser/247/ HTTP/1.0" 200 3404 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 53 | 10.254.254.138 - - [06/Aug/2007:00:09:49 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baag.jpg HTTP/1.0" 302 3940 "-" "googlebot-mscrawl-moma" 54 | 10.1.40.113 - - [06/Aug/2007:00:12:18 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baaf.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1; Google-TR-3) Gecko/20060111 Firefox/1.5.0.1" 55 | 10.254.254.103 - - [06/Aug/2007:00:13:27 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baah.jpg HTTP/1.0" 404 414 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 56 | 10.254.254.28 - - [06/Aug/2007:00:14:26 -0700] "GET /keyser/23367/ HTTP/1.0" 302 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 57 | 10.254.254.28 - - [06/Aug/2007:00:13:47 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baaj.jpg HTTP/1.0" 302 414 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 58 | 10.254.254.28 - - [06/Aug/2007:00:05:38 -0700] "GET /baz/img/rss.png HTTP/1.0" 404 3404 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1" 59 | 10.254.254.138 - - [06/Aug/2007:00:06:15 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babe.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 60 | 10.254.254.94 - - [06/Aug/2007:00:11:08 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baaa.jpg HTTP/1.0" 200 6962 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 61 | 10.254.254.138 - - [06/Aug/2007:00:13:56 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baab.jpg HTTP/1.0" 200 4290 "-" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1" 62 | 10.254.254.193 - - [06/Aug/2007:00:12:19 -0700] "GET /baz/img/powered_by_engedu.png HTTP/1.1" 302 527 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 63 | 10.254.254.28 - - [06/Aug/2007:00:11:08 -0700] "GET /favicon.ico HTTP/1.0" 404 4288 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 64 | 10.254.254.138 - - [06/Aug/2007:00:10:04 -0700] "GET /baz/img/rss.png HTTP/1.1" 200 3404 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 65 | 10.254.254.138 - - [06/Aug/2007:00:12:18 -0700] "GET /?qdetail=1&qid=889 HTTP/1.0" 302 22950 "-" "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4" 66 | 10.254.254.65 - - [06/Aug/2007:00:05:38 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babe.jpg HTTP/1.0" 302 19124 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 67 | 10.254.254.29 - - [06/Aug/2007:00:09:23 -0700] "GET /keyser/24417/ HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 68 | 10.1.40.113 - - [06/Aug/2007:00:13:48 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baad.jpg HTTP/1.0" 200 540 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 69 | 10.254.254.193 - - [06/Aug/2007:00:11:14 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baah.jpg HTTP/1.0" 200 3404 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 70 | 10.254.254.58 - - [06/Aug/2007:00:06:17 -0700] "GET /favicon.ico HTTP/1.1" 302 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 71 | 10.254.254.28 - - [06/Aug/2007:00:13:40 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babi.jpg HTTP/1.0" 200 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 72 | 10.1.40.113 - - [06/Aug/2007:00:14:53 -0700] "GET /keyser/24535/ HTTP/1.0" 200 402 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 73 | 10.254.254.28 - - [06/Aug/2007:00:06:51 -0700] "GET /keyser/24189/ HTTP/1.0" 301 527 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 74 | 10.254.254.28 - - [06/Aug/2007:00:06:08 -0700] "GET /keyser/24884 HTTP/1.0" 302 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 75 | 10.254.254.38 - - [06/Aug/2007:00:12:18 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baba.jpg HTTP/1.0" 404 7929 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 76 | 10.254.254.138 - - [06/Aug/2007:00:09:49 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-babh.jpg HTTP/1.0" 200 12969 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 77 | 10.1.40.113 - - [06/Aug/2007:00:13:56 -0700] "GET /baz/img/techtalk_logo.png HTTP/1.1" 200 528 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 78 | 10.254.254.138 - - [06/Aug/2007:00:05:31 -0700] "GET /edu/languages/google-python-class/images/puzzle/a-baaj.jpg HTTP/1.0" 302 4067 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 79 | 10.254.254.65 - - [06/Aug/2007:00:13:41 -0700] "GET /favicon.ico HTTP/1.0" 302 3404 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 80 | 10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /baz/css/fish.css HTTP/1.1" 302 5694 "-" "googlebot-mscrawl-moma (enterprise; bar-XYZ; foo123@google.com,foo123@google.com,foo123@google.com,foo123@google.com)" 81 | -------------------------------------------------------------------------------- /logpuzzle/logpuzzle.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | import os 10 | import re 11 | import sys 12 | import urllib 13 | 14 | """Logpuzzle exercise 15 | Given an apache logfile, find the puzzle urls and download the images. 16 | 17 | Here's what a puzzle url looks like: 18 | 10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 19 | """ 20 | 21 | 22 | def word_key(s): 23 | return s.split('-')[-1] 24 | 25 | def read_urls(filename): 26 | """Returns a list of the puzzle urls from the given log file, 27 | extracting the hostname from the filename itself. 28 | Screens out duplicate urls and returns the urls sorted into 29 | increasing order. 30 | 31 | Example: 32 | 33 | ./logpuzzle.py animal_code.google.com 34 | http://code.google.com/something/puzzle-animal-baaa.jpg 35 | http://code.google.com/something/puzzle-animal-baab.jpg 36 | ... 37 | """ 38 | 39 | domain = re.search(r'_(.+)', filename).group(1) 40 | matches = set() 41 | f = open(filename) 42 | 43 | for line in f: 44 | match = re.search(r'GET (.+) HTTP', line) 45 | if match: 46 | if "puzzle" in match.group(1): 47 | matches.add("http://" + domain + match.group(1)) 48 | 49 | f.close() 50 | 51 | return sorted(matches, key=word_key) 52 | 53 | 54 | def download_images(img_urls, dest_dir): 55 | """Given the urls already in the correct order, downloads 56 | each image into the given directory. 57 | Gives the images local filenames img0, img1, and so on. 58 | Creates an index.html in the directory 59 | with an img tag to show each local image file. 60 | Creates the directory if necessary. 61 | 62 | Example: 63 | 64 | ./logpuzzle.py --todir animaldir animal_code.google.com 65 | ls animaldir 66 | img0 img1 img2 img3 img4 img5 img6 img7 img8 img9 index.html 67 | """ 68 | 69 | # See if dest_dir exists--if not, create it 70 | if not os.path.isdir(dest_dir): 71 | os.makedirs(dest_dir) 72 | 73 | # Build HTML 74 | html_parts = [""] 75 | 76 | for i, url in enumerate(img_urls): 77 | try: 78 | # Download image 79 | ufile = urllib.urlopen(url) 80 | img = ufile.read() 81 | f = open("./%s/img%d" % (dest_dir, i), 'wb') 82 | f.write(img) 83 | f.close() 84 | 85 | # Add image tag 86 | html_parts.append('' % i) 87 | except IOError: 88 | print 'problem reading url:', url 89 | 90 | html_parts.append("") 91 | 92 | # Write HTML file 93 | f = open('./' + dest_dir + '/index.html','w') 94 | f.write(''.join(html_parts)) 95 | f.close() 96 | 97 | 98 | def main(): 99 | args = sys.argv[1:] 100 | 101 | if not args: 102 | print 'usage: [--todir dir] logfile ' 103 | sys.exit(1) 104 | 105 | todir = '' 106 | if args[0] == '--todir': 107 | todir = args[1] 108 | del args[0:2] 109 | 110 | img_urls = read_urls(args[0]) 111 | 112 | if todir: 113 | download_images(img_urls, todir) 114 | else: 115 | print '\n'.join(img_urls) 116 | 117 | if __name__ == '__main__': 118 | main() 119 | -------------------------------------------------------------------------------- /logpuzzle/solution/logpuzzle.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright 2010 Google Inc. 3 | # Licensed under the Apache License, Version 2.0 4 | # http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | # Google's Python Class 7 | # http://code.google.com/edu/languages/google-python-class/ 8 | 9 | import os 10 | import re 11 | import sys 12 | import urllib 13 | 14 | """Logpuzzle exercise 15 | Given an apache logfile, find the puzzle urls and download the images. 16 | 17 | Here's what a puzzle url looks like: 18 | 10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 19 | """ 20 | 21 | # LAB(begin solution) 22 | def url_sort_key(url): 23 | """Used to order the urls in increasing order by 2nd word if present.""" 24 | match = re.search(r'-(\w+)-(\w+)\.\w+', url) 25 | if match: 26 | return match.group(2) 27 | else: 28 | return url 29 | # LAB(end solution) 30 | 31 | def read_urls(filename): 32 | """Returns a list of the puzzle urls from the given log file, 33 | extracting the hostname from the filename itself. 34 | Screens out duplicate urls and returns the urls sorted into 35 | increasing order.""" 36 | # +++your code here+++ 37 | # LAB(begin solution) 38 | # Extract the hostname from the filename 39 | underbar = filename.index('_') 40 | host = filename[underbar + 1:] 41 | 42 | # Store the ulrs into a dict to screen out the duplicates 43 | url_dict = {} 44 | 45 | f = open(filename) 46 | for line in f: 47 | # Find the path which is after the GET and surrounded by spaces. 48 | match = re.search(r'"GET (\S+)', line) 49 | # Above uses \S (upper case S) which is any non-space char 50 | # Alternately could use square brackets: "GET ([^ ]+)" 51 | # or the ? form: "GET (.+?) " 52 | 53 | if match: 54 | path = match.group(1) 55 | # Add to dict if it's a special "puzzle" url 56 | # (could combine this 'puzzle' check with the above GET extraction) 57 | if 'puzzle' in path: 58 | url_dict['http://' + host + path] = 1 59 | 60 | return sorted(url_dict.keys(), key=url_sort_key) 61 | # LAB(end solution) 62 | 63 | 64 | def download_images(img_urls, dest_dir): 65 | """Given the urls already in the correct order, downloads 66 | each image into the given directory. 67 | Gives the images local filenames img0, img1, and so on. 68 | Creates an index.html in the directory 69 | with an img tag to show each local image file. 70 | Creates the directory if necessary. 71 | """ 72 | # +++your code here+++ 73 | # LAB(begin solution) 74 | if not os.path.exists(dest_dir): 75 | os.makedirs(dest_dir) 76 | 77 | index = file(os.path.join(dest_dir, 'index.html'), 'w') 78 | index.write('\n') 79 | 80 | i = 0 81 | for img_url in img_urls: 82 | local_name = 'img%d' % i 83 | print 'Retrieving...', img_url 84 | urllib.urlretrieve(img_url, os.path.join(dest_dir, local_name)) 85 | 86 | index.write('' % (local_name,)) 87 | i += 1 88 | 89 | index.write('\n\n') 90 | index.close() 91 | # LAB(end solution) 92 | 93 | 94 | def main(): 95 | args = sys.argv[1:] 96 | 97 | if not args: 98 | print 'usage: [--todir dir] logfile ' 99 | sys.exit(1) 100 | 101 | todir = '' 102 | if args[0] == '--todir': 103 | todir = args[1] 104 | del args[0:2] 105 | 106 | img_urls = read_urls(args[0]) 107 | 108 | if todir: 109 | download_images(img_urls, todir) 110 | else: 111 | print '\n'.join(img_urls) 112 | 113 | if __name__ == '__main__': 114 | main() 115 | --------------------------------------------------------------------------------