├── .gitignore ├── 1-hello-world ├── Codecademy.swift ├── Hello.swift ├── Letter.swift ├── Pattern.swift ├── art │ ├── folder-icon.png │ ├── folder-icon.svg │ └── terminal.png └── block-letters │ ├── BlockLetter.PY │ ├── block-letters-hint.png │ ├── block-letters.png │ ├── block_letters.py │ ├── initials.py │ └── snowman.py ├── 2-control-flow ├── WWTBAM.py ├── area_calculator.py ├── art │ ├── donut_factory.gif │ └── first-bug.jpg ├── fortune.py ├── magic-8-ball │ ├── magic-8-ball.py │ └── magic8.py ├── sals-shipping │ └── shipping.py └── space.py ├── LICENSE ├── README.md └── style-guide.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Byte-compiled / optimized / DLL files 4 | __pycache__/ 5 | *.py[cod] 6 | *$py.class 7 | 8 | # C extensions 9 | *.so 10 | 11 | # Distribution / packaging 12 | .Python 13 | build/ 14 | develop-eggs/ 15 | dist/ 16 | downloads/ 17 | eggs/ 18 | .eggs/ 19 | lib/ 20 | lib64/ 21 | parts/ 22 | sdist/ 23 | var/ 24 | wheels/ 25 | pip-wheel-metadata/ 26 | share/python-wheels/ 27 | *.egg-info/ 28 | .installed.cfg 29 | *.egg 30 | MANIFEST 31 | 32 | # PyInstaller 33 | # Usually these files are written by a python script from a template 34 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 35 | *.manifest 36 | *.spec 37 | 38 | # Installer logs 39 | pip-log.txt 40 | pip-delete-this-directory.txt 41 | 42 | # Unit test / coverage reports 43 | htmlcov/ 44 | .tox/ 45 | .nox/ 46 | .coverage 47 | .coverage.* 48 | .cache 49 | nosetests.xml 50 | coverage.xml 51 | *.cover 52 | *.py,cover 53 | .hypothesis/ 54 | .pytest_cache/ 55 | 56 | # Translations 57 | *.mo 58 | *.pot 59 | 60 | # Django stuff: 61 | *.log 62 | local_settings.py 63 | db.sqlite3 64 | db.sqlite3-journal 65 | 66 | # Flask stuff: 67 | instance/ 68 | .webassets-cache 69 | 70 | # Scrapy stuff: 71 | .scrapy 72 | 73 | # Sphinx documentation 74 | docs/_build/ 75 | 76 | # PyBuilder 77 | target/ 78 | 79 | # Jupyter Notebook 80 | .ipynb_checkpoints 81 | 82 | # IPython 83 | profile_default/ 84 | ipython_config.py 85 | 86 | # pyenv 87 | .python-version 88 | 89 | # pipenv 90 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 91 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 92 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 93 | # install all needed dependencies. 94 | #Pipfile.lock 95 | 96 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 97 | __pypackages__/ 98 | 99 | # Celery stuff 100 | celerybeat-schedule 101 | celerybeat.pid 102 | 103 | # SageMath parsed files 104 | *.sage.py 105 | 106 | # Environments 107 | .env 108 | .venv 109 | env/ 110 | venv/ 111 | ENV/ 112 | env.bak/ 113 | venv.bak/ 114 | 115 | # Spyder project settings 116 | .spyderproject 117 | .spyproject 118 | 119 | # Rope project settings 120 | .ropeproject 121 | 122 | # mkdocs documentation 123 | /site 124 | 125 | # mypy 126 | .mypy_cache/ 127 | .dmypy.json 128 | dmypy.json 129 | 130 | # Pyre type checker 131 | .pyre/ 132 | -------------------------------------------------------------------------------- /1-hello-world/Codecademy.swift: -------------------------------------------------------------------------------- 1 | // There is one "a" in Codecademy. 2 | 3 | print("Codecademy") 4 | -------------------------------------------------------------------------------- /1-hello-world/Hello.swift: -------------------------------------------------------------------------------- 1 | print("Hello, world!") 2 | -------------------------------------------------------------------------------- /1-hello-world/Letter.swift: -------------------------------------------------------------------------------- 1 | print("Dear Self,") 2 | print("Build a dope mobile app.") 3 | print("Sonny") 4 | print("January 2020, New York") 5 | -------------------------------------------------------------------------------- /1-hello-world/Pattern.swift: -------------------------------------------------------------------------------- 1 | print(" 1") 2 | print(" 2 3") 3 | print(" 4 5 6") 4 | print("7 8 9 10") 5 | -------------------------------------------------------------------------------- /1-hello-world/art/folder-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-python/35caefdf5548153f0852274b28ce34317e04086b/1-hello-world/art/folder-icon.png -------------------------------------------------------------------------------- /1-hello-world/art/folder-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /1-hello-world/art/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-python/35caefdf5548153f0852274b28ce34317e04086b/1-hello-world/art/terminal.png -------------------------------------------------------------------------------- /1-hello-world/block-letters/BlockLetter.PY: -------------------------------------------------------------------------------- 1 | # AJ Nunez 2 | # Fun Fact: I love baseball ⚾️ 3 | 4 | print(" A JJJJJ ") 5 | print(" A A J ") 6 | print(" A A J ") 7 | print(" AAAAA J ") 8 | print(" A A J J ") 9 | print(" A A J J ") 10 | print(" A A JJ ") 11 | -------------------------------------------------------------------------------- /1-hello-world/block-letters/block-letters-hint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-python/35caefdf5548153f0852274b28ce34317e04086b/1-hello-world/block-letters/block-letters-hint.png -------------------------------------------------------------------------------- /1-hello-world/block-letters/block-letters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-python/35caefdf5548153f0852274b28ce34317e04086b/1-hello-world/block-letters/block-letters.png -------------------------------------------------------------------------------- /1-hello-world/block-letters/block_letters.py: -------------------------------------------------------------------------------- 1 | # My name is Shubham Kumar Tripathi. 2 | # I am a very honest person. 3 | 4 | name = ''' SSS K K TTTTT 5 | S S K K T 6 | S K K T 7 | SSS KK T 8 | S K K T 9 | S S K K T 10 | SSS K K T ''' 11 | 12 | print(name) 13 | -------------------------------------------------------------------------------- /1-hello-world/block-letters/initials.py: -------------------------------------------------------------------------------- 1 | # Sonny Li 2 | # Fun Fact: I played guitar in a band called Attica. 3 | 4 | print(" SSS L ") 5 | print(" S S L ") 6 | print(" S L ") 7 | print(" SSS L ") 8 | print(" S L ") 9 | print(" S S L ") 10 | print(" SSS LLLLL ") -------------------------------------------------------------------------------- /1-hello-world/block-letters/snowman.py: -------------------------------------------------------------------------------- 1 | # Twitter: @anne_melody 2 | # Fun Fact: I drink a looot of water. 3 | 4 | print(" * * ") 5 | print(" * ") 6 | print("* * * ") 7 | print(" * * * ") 8 | print(" HHHHHHH * ") 9 | print(" * HHHHHHH ") 10 | print(" * HHHHHHHHHHH * * ") 11 | print(" * @ @ * ") 12 | print(" * ^ * ") 13 | print(" * * * * ") 14 | print(" SSS * * S ") 15 | print(" * SSSSSSSS * ") 16 | print(" * O SS * ") 17 | print(" * O S * ") 18 | print(" * O * ") 19 | print(" * * ") 20 | print(" * * * ") -------------------------------------------------------------------------------- /2-control-flow/WWTBAM.py: -------------------------------------------------------------------------------- 1 | # Who Wants To Be A Millionaire 💰 2 | 3 | score = 0 4 | 5 | option1 = 'Fresca' 6 | option2 = 'V8' 7 | option3 = 'Yoo-hoo' 8 | option4 = 'A&W' 9 | 10 | print("For ordering his favorite beverages on demand, LBJ had four buttons installed in the Oval Office labeled 'Coffee', 'Tea', 'Coke', and what?\n") 11 | 12 | print("A.", option1) 13 | print("B.", option2) 14 | print("C.", option3) 15 | print("D.", option4) 16 | 17 | answer = 'a' 18 | 19 | if answer == 'A' or answer == 'a': 20 | score += 100 21 | print("\nCorrect!") 22 | else: 23 | print("\nNope, sorry!") -------------------------------------------------------------------------------- /2-control-flow/area_calculator.py: -------------------------------------------------------------------------------- 1 | # Area Calculator 📏 2 | 3 | import math 4 | 5 | base = 20 6 | height = 30 7 | area = base * height / 2 8 | 9 | print("The triangle area is", area) 10 | 11 | length = 2 12 | width = 12 13 | area = length * width 14 | 15 | print("The rectangle area is", area ) 16 | 17 | radius = 36 18 | area = math.pi * radius * radius 19 | 20 | print("The circle area is", area) -------------------------------------------------------------------------------- /2-control-flow/art/donut_factory.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-python/35caefdf5548153f0852274b28ce34317e04086b/2-control-flow/art/donut_factory.gif -------------------------------------------------------------------------------- /2-control-flow/art/first-bug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Codecademy/learn-python/35caefdf5548153f0852274b28ce34317e04086b/2-control-flow/art/first-bug.jpg -------------------------------------------------------------------------------- /2-control-flow/fortune.py: -------------------------------------------------------------------------------- 1 | # Fortune Cookie 🥠 2 | 3 | import random 4 | 5 | fortune = random.randint(0, 4) 6 | 7 | if fortune == 0: 8 | print("May you one day be carbon neutral") 9 | elif fortune == 1: 10 | print("You have rice in your teeth") 11 | elif fortune == 2: 12 | print("No snowflake feels responsible for an avalanche") 13 | elif fortune == 3: 14 | print("You can only connect the dots looking backwards") 15 | elif fortune == 4: 16 | print("The fortune you seek is in another cookie") -------------------------------------------------------------------------------- /2-control-flow/magic-8-ball/magic-8-ball.py: -------------------------------------------------------------------------------- 1 | # Magic 8-Ball 🎱 2 | # Galina Podstrechnaya 3 | 4 | import random 5 | 6 | playerName = "Galina" 7 | playerQuestion = "Will there be any more snowfall in New York for winter 2020? ❄️" 8 | 9 | randomNumber = random.randint(1, 9) 10 | # print(randomNumber) 11 | 12 | if randomNumber == 1: 13 | eightBall = "Yes - definitely" 14 | elif randomNumber == 2: 15 | eightBall = "It is decidedly so" 16 | elif randomNumber == 3: 17 | eightBall = "Without a doubt" 18 | elif randomNumber == 4: 19 | eightBall = "Reply hazy, try again" 20 | elif randomNumber == 5: 21 | eightBall = "Ask again later" 22 | elif randomNumber == 6: 23 | eightBall = "Better not tell you now" 24 | elif randomNumber == 7: 25 | eightBall = "My sources say no" 26 | elif randomNumber == 8: 27 | eightBall = "Outlook not so good" 28 | elif randomNumber == 9: 29 | eightBall = "Very doubtful" 30 | else: 31 | eightBall = "Error" 32 | 33 | print(playerName, "\'s Question:", playerQuestion) 34 | 35 | # Challenge: 36 | # playerName.isEmpty ? print("Question: \(playerQuestion)") : print("\(playerName) asks: \(playerQuestion)") 37 | 38 | print("🎱:", eightBall) -------------------------------------------------------------------------------- /2-control-flow/magic-8-ball/magic8.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | name = "Joe" 4 | question = "Will I win the lottery?" 5 | answer = "" 6 | 7 | random_number = random.randint(1, 9) 8 | # print(random_number) 9 | 10 | if random_number == 1: 11 | answer = "Yes - definitely" 12 | elif random_number == 2: 13 | answer = "It is decidedly so" 14 | elif random_number == 3: 15 | answer = "Without a doubt" 16 | elif random_number == 4: 17 | answer = "Reply hazy, try again" 18 | elif random_number == 5: 19 | answer = "Ask again later" 20 | elif random_number == 6: 21 | answer = "Better not tell you now" 22 | elif random_number == 7: 23 | answer = "My sources say no" 24 | elif random_number == 8: 25 | answer = "Outlook not so good" 26 | elif random_number == 9: 27 | answer = "Very doubtful" 28 | else: 29 | answer = "Error" 30 | 31 | print(name + " asks: " + question) 32 | print("Magic 8 Ball's answer: " + answer) 33 | -------------------------------------------------------------------------------- /2-control-flow/sals-shipping/shipping.py: -------------------------------------------------------------------------------- 1 | # Sal's Shipping 2 | # Sonny Li 3 | 4 | weight = 80 5 | 6 | # Ground Shipping 🚚 7 | 8 | if weight <= 2: 9 | cost_ground = weight * 1.5 + 20 10 | elif weight <= 6: 11 | cost_ground = weight * 3.00 + 20 12 | elif weight <= 10: 13 | cost_ground = weight * 4.00 + 20 14 | else: 15 | cost_ground = weight * 4.75 + 20 16 | 17 | print("Ground Shipping $", cost_ground) 18 | 19 | # Ground Shipping Premimum 🚚💨 20 | 21 | cost_ground_premium = 125.00 22 | 23 | print("Ground Shipping Premimium $", cost_ground_premium) 24 | 25 | # Drone Shipping 🛸 26 | 27 | if weight <= 2: 28 | cost_drone = weight * 4.5 29 | elif weight <= 6: 30 | cost_drone = weight * 9.00 31 | elif weight <= 10: 32 | cost_drone = weight * 12.00 33 | else: 34 | cost_drone = weight * 14.25 35 | 36 | print("Drone Shipping: $", cost_drone) -------------------------------------------------------------------------------- /2-control-flow/space.py: -------------------------------------------------------------------------------- 1 | # Space Boxer 🥊 2 | # Sonny Li 3 | 4 | print("I have information for the following planets:\n") 5 | 6 | print(" 1. Venus 2. Mars 3. Jupiter") 7 | print(" 4. Saturn 5. Uranus 6. Neptune\n") 8 | 9 | weight = 185 10 | planet = 3 11 | 12 | # Write an if statement below: 13 | 14 | if planet == 1: 15 | weight = weight * 0.91 16 | elif planet == 2: 17 | weight = weight * 0.38 18 | elif planet == 3: 19 | weight = weight * 2.34 20 | elif planet == 4: 21 | weight = weight * 1.06 22 | elif planet == 5: 23 | weight = weight * 0.92 24 | elif planet == 6: 25 | weight = weight * 1.19 26 | 27 | print("Your weight:", weight) 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Codecademy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Learn Python 3 2 | 3 | 4 | 5 | 6 | 7 | **Senior Curriculum Developer:** Sonny Li 8 | 9 | **Senior Curriculum Developer:** David Patlut (dpatlut@codecademy.com) 10 | 11 | 12 | 13 | 14 | 15 | [1]: http://i.imgur.com/wWzX9uB.png (twitter icon without padding) 16 | [2]: http://i.imgur.com/9I6NRUm.png (github icon without padding) 17 | [3]: http://i.imgur.com/fep1WsG.png (facebook icon without padding) 18 | [4]: http://i.imgur.com/VlgBKQ9.png (google plus icon without padding) 19 | [5]: http://i.imgur.com/jDRp47c.png (tumblr icon without padding) 20 | [6]: http://i.imgur.com/Vvy3Kru.png (dribbble icon without padding) 21 | 22 | **Artwork:** Tim Liedtke (https://www.timliedtke.com) 23 | 24 | ## Course Link ## 25 | 26 | https://www.codecademy.com/learn/learn-python-3 27 | 28 | ### Book ### 29 | 30 | TBD 31 | 32 | ## 1. Hello World ## 33 | 34 | 38 | 39 | TBD 40 | 41 | **Block Letters:** 42 | 43 | - [x] [`initials.py`](1-hello-world/block-letters/initials.swift) 44 | - [x] [`snowman.py`](1-hello-world/block-letters/snowman.swift) 45 | 46 | 68 | 69 | ## 2. Control Flow ## 70 | 71 | - [x] [`space.py`](https://github.com/Codecademy/learn-python/blob/main/2-control-flow/space.py) 72 | - [x] [`fortune_cookie.py`](https://github.com/Codecademy/learn-python/blob/main/2-control-flow/fortune.py) 73 | - [x] [`who_wants_to_be_a_millionaire.py`](https://github.com/Codecademy/learn-python/blob/main/2-control-flow/WWTBAM.py) 74 | - [x] [`area_calculator.py`](https://github.com/Codecademy/learn-python/blob/main/2-control-flow/area_calculator.py) 75 | 76 | **Magic 8-Ball:** 77 | 78 | 79 | - [x] [`magic8.py`](https://github.com/Codecademy/learn-python/blob/main/2-control-flow/magic-8-ball/magic8.py) 80 | 81 | 126 | 127 | --- 128 | 129 | ### Cheatsheets ### 130 | 131 | 1. [Hello World](https://www.codecademy.com/learn/learn-python-3/modules/learn-python3-hello-world/cheatsheet) 132 | 2. [Control Flow](https://www.codecademy.com/learn/learn-python-3/modules/learn-python3-control-flow/cheatsheet) 133 | 3. [Functions](https://www.codecademy.com/learn/learn-python-3/modules/learn-python3-functions/cheatsheet) 134 | 135 | ### Codepedia ### 136 | 137 | https://codecademy.github.io/codepedia 138 | 139 | ### Skill Paths ### 140 | 141 | - Analyze Data with Python 142 | - Visualize Data with Python 143 | - Build Chatbots with Python 144 | - Build Web Apps with Flask 145 | - Build Deep Learning Models with TensorFlow 146 | - Build a Machine Learning Mode with Python 147 | 148 | ### Courses ### 149 | 150 | - Learn Hardware Programming with CircuitPython 151 | - Learn Statistics with Python 152 | - Learn Flask 153 | 154 | ### Official Documentation ### 155 | 156 | - https://docs.python.org/3 157 | 158 | ### Python Style Guides ### 159 | 160 | * Codecademy Python Style Guide - TBA 161 | * [PEP 8 Style Guide](https://www.python.org/dev/peps/pep-0008/) 162 | * [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) 163 | 164 | ## Contribution Guidelines 165 | 166 | We'd love to have you contribute! 167 | 168 | Please note that this project is released with a [Contributor Covenant](https://www.contributor-covenant.org). 169 | By participating in this project you agree to abide by its terms. 170 | -------------------------------------------------------------------------------- /style-guide.md: -------------------------------------------------------------------------------- 1 | # Codecademy Curriculum Python Style Guide 2 | 3 | 4 | ## Comments 5 | 6 | - There should be a space between the hashtag and the text for readability. 7 | - Use multiple `#`s for multiline comments. 8 | - When the output is something short, e.g. one line, the output is either included immediately after the function/method call with some text like "`Output: ...`". If that output extends beyond the length of the block, the comment can be included under the function/method call. 9 | 10 | ```py 11 | print("Hi") # Output: Hi 12 | ``` 13 | 14 | Or: 15 | 16 | ```py 17 | print("Hello World!") 18 | # Output: Hello World! 19 | ``` 20 | 21 | - If the output is more than a single line, typically, we'll show the code snippet (with syntax highlighting) that we're using. Followed by plain text that reads something like, "Which prints out:". And then some unstyled code snippet (like a bash terminal). 22 | 23 | ```py 24 | print(string1 + string2 + ".") 25 | print(string3 + ".") 26 | ``` 27 | 28 | This will print out: 29 | 30 | ```bash 31 | Hello goodbye. 32 | Blah. 33 | ``` 34 | 35 | ### Whitespace 36 | 37 | space or tab? Team spaces! 38 | 39 | ### Names 40 | 41 | - For functions, use `()` after the function name. For example, `say_name()`. 42 | - For mehtods, use `.` in front of the method name. For example, `.talk()`. 43 | - For properties, use `.` in front of the property name. For example, `.count`. 44 | 45 | --- 46 | 47 | ### To Be Determined... 48 | 49 | - Do we capitalize the first word or not in a comment if it's a full sentence? 50 | - 👍 Yes: Sonny, Kenny, David, Sarai, Alex K, Alisha 51 | - 👎 No: Sophie, Jamie, Alex D, Cole, Chris, Carolyn 52 | 53 | - Single vs Double Quotes in Python strings? 54 | - `"` Double: Alex K, Alex D, Sarai, Mariel, Cole, Adam 55 | - `'` Single: Alisha, David, Sophie, Jamie 56 | --------------------------------------------------------------------------------