diff --git a/README.md b/README.md index 326ebdc..fa2a637 100644 --- a/README.md +++ b/README.md @@ -1,107 +1,104 @@ -# Python for Absolute Beginners Course +# ʺڸ ̽ ڽ ![](readme_resources/absolute-beginners.jpg) -Code samples and other handouts for our course. See the [**practice exercises**](/practices) for following along with the course. + ڵ ð ι. 󰡷 [**practice exercises**](/practices) ϼ. -## Course Summary +## ڽ -Learning to program can be overwhelming. Concepts and facts come at you fast and most courses don't cover many of them at all or at a beginner's pace. **This is not most courses**. Python for absolute beginners is our premier course for beginning developers. We start at the very beginning, teaching you the big ideas and concepts covered in a CS 101 course. Then we move on to writing increasingly complex code and applications in Python. +α׷ е ֽϴ. ޵Ǹ κ κ ٷ ʰų ʺ ӵ ٷ ʽϴ. **κ ƴմϴ** ʺڸ ̽ ʺ ڸ ְ Դϴ. CS 101 ٷ ū ̵ ġ鼭 ó մϴ. ׷ ڵ ø̼ ̽ ۼմϴ. +## л ϴ -## What students are saying +ʺڸ ̽ س°, CodeAcademy LinkedIn Learning ֽϴ ( ƴմϴ). α׷ ϴ. Ŀŧ ſ ϴ. Բ ּż մϴ. -Python for Beginners was really well done, I have CodeAcademy and LinkedIn Learning (not bad mouthing them) but until I had your program I was really struggling. Course curriculum is very good. Thanks for putting this together. +## ̸  ٸ? +κ ڽ α׷ְ ̽ ** ݴϴ. + ֽϴ. + ׽ƮϿ α׷  θ ϰ ϴ ֽϴ. +׵ Ÿ, , Լ α׷ 信 ͼϰ ̽㿡 װ͵  ϴ λ׸ ȴٰ մϴ. -## What's this course about and how is it different? -Most courses teach you the *facts* of programming and Python. Here is -how a loop is constructed. Here is how you test a condition and make -your program choose one path or another. Often they assume that you are -familiar with programming concepts such as data types, loops, functions, -and so on and that you just need to learn the details of how to do this in -Python. +** κ ڽʹ ٸϴ**. + ̽ Ͽ Ʈ ʸ ʹٸ, ڽ ڽԴϴ! -**This course is not most courses**. If you want ground up coverage of -software development using Python as the technology, this is your course! - -We spend significant time setting the stage to make sure you have -the big concepts clearly covered before diving into writing code. We -explicitly discuss how to approach problem solving when writing code -so that you don't have that *deer in the headlines* feeling. +츮 ڵ带 ū Ȯϰ ٷ ֵ 븦 µ ð Ҿմϴ. +츮 ڵ带 ۼ ذῡ ϴ Ȯϰ Ͽ *ο * ʵ մϴ. -And the course content isn't just facts. You will see a lot of code -written before your eyes. That code isn't boring `foo()` this and -`bar()` that. **We build several fun and challenging games covering a wide -range of topics** that will be entirely relevant to your professional -projects. - -If you never had that formal computer science background but need to -jump into programming and Python, this course has your back. +׸ ڽ ܼ ƴմϴ. + տ ڵ尡 ִ Դϴ. + ڵ`foo()` `bar()` ʽϴ. +**츮 پ ٷ ְ ϴ.** +װ Ʈ Դϴ. + ǻ α׷ְ ̽㿡 پ ʿ䰡 ִٸ, ڽ ſ Դϴ.. -## What topics are covered -In this course, you will: +## ٷ -* Learn how to install Python and a proper editor to write code on your computer. -* See a quick, high-level overview of the *big ideas* of computer programming (e.g. data structures). -* Understand how Python executes a program and turns what you write into executable software. -* See how Python defines data types (integers, strings, etc.) and how to convert between them. -* Create interactive code that has a *conversation* with the user or data. -* Use functions to make your code more maintainable and reusable. -* Choose the right data structure to significantly improve the clarity and performance of your code. -* Create a basic AI / computer opponent for the games built during the course. -* Learn many problem solving techniques to help you dive right into writing code productively. -* See resources to help visualize connections between data created by your code. -* Work with multiple file formats to read and write data as our program runs. -* Use external libraries from [pypi.org](https://pypi.org). -* Add error handling to your application for a polished, reliable application. -* And lots more + : -View the full [course outline](https://training.talkpython.fm/courses/explore_beginners/python-for-absolute-beginners#course_outline). +* ̽ ġϴ ǻͿ ڵ带 ִ ⸦ +* ǻ α׷(: ) * ̵* 並 ϼ. +* ̽ α׷ ϰ ۼ Ʈ ȯϴ Ͻʽÿ. +* ̽ Ÿ (, ڿ ) ϴ Ÿ԰ ȯϴ ȮϽʽÿ. +* Ǵ Ϳ *ȯ* ִ ȭ ڵ带 ʽÿ. +* ڵ带 ϰ ֵ Լ Ͻʽÿ. +* ڵ Ȯ ũ Ű Ͻʽÿ. +* ڽ ӿ ⺻ AI / ǻ ʽÿ. +* ڵ带 ۼϴ Ǵ ذ ʽÿ. +* ڵ ðȭϴ Ǵ ҽ Ͻʽÿ. +* α׷ Ǵ Ͽ ͸ а ʽÿ. +* [pypi.org](https://pypi.org) ܺ ̺귯 Ͻʽÿ. +* õǰ ŷ ִ α׷ α׷ ó ߰Ͻʽÿ. +* ׸ +ü [course outline](https://training.talkpython.fm/courses/explore_beginners/python-for-absolute-beginners#course_outline) . -## Who is this course for? -This course is for **anyone who wants to learn Python and computer programming**. If you haven't had a formal education in software development or have tried other courses and programming "didn't stick", then you are a great candidate student. +## ڽ ڽΰ? -The student requirements are quite light for this course. You'll need: + ڽ **̽ ǻ α׷ ** ڽԴϴ. Ʈ ߿ ʾҰų ٸ ڽ õغų α׷ ʾҴٸ, Ǹ лԴϴ. -* Basic typing skills -* Foundational computer experience (installing software etc.) -* A simple computer (macOS, Windows, or Linux) -* A desire to learn programming + ڽ л ʿ ϴ. ʿ ׸: -**Note**: All software used during this course, including editors, Python language, etc., are 100% free and open source. You won't have to buy anything to take the course. +* ⺻ Ÿ +* ⺻ ǻ (Ʈ ġ ) +* ǻ (OS, , Ǵ ) +* α׷ +****: , ̽ Ͽ ڽ Ǵ Ʈ 100% ҽ, ¸ ϱ ƹ͵ ʾƵ Դϴ. -## What games will we build? -I believe it's important to learn programming in the context of something that feels plausible and real. We won't build a bunch of disconnected loops and other programming examples that don't relate back to real programs. We will build several fun games that cover meaningful content that any elementary -Python course would cover. +##  ? -1. **Guess the number of M&Ms in a jar** -2. **TIC-TAC-TOE** -3. **Rock-Paper-Scissors (3-way and 7-way)** -4. **A Connect4 clone** +׷ϰ ̶  ƶ α׷ ߿ϴٰ Ͻϴ. +츮 α׷ ٸ α׷ õ ̴. +츮  ʱ ڽ ٷ ǹ ִ ٷ ִ Դϴ. +1. **׾Ƹ ִ M&M Ͻʽÿ** +2. ** tic tac toe ** +3. **(3 7** +4. **4 ** -## The time to act is now -If you've always wanted to learn programming and are considering Python as your gateway into that world, this is the course for you. We will fill in the concepts that would normally be covered in a CS 101 course without wasting your time taking semesters to cover what can be learned and practiced in a week or two. +## ൿ Դϴ. -Dive into Python and become a software developer with this course. Join today! You've got nothing to lose. Every one of our courses comes with a 2-week money-back guarantee. +α׷ ; ̽  ϰ ִٸ, ̰ ڽԴϴ. +츮 CS 101 ڽ нϰ ִ ̳ 2 ȿ ٷ б⸦ ϴ ð ʰ ä Դϴ. -Visit the [**course page to sign up**](https://training.talkpython.fm/courses/explore_beginners/python-for-absolute-beginners). +̽㿡  ڽ Ʈ ڰ ǽʽÿ. + ٷ Ͻʽÿ! + ϴ. ڽ 2ְ ȯ մϴ. + [**course page to sign up**](https://training.talkpython.fm/courses/explore_beginners/python-for-absolute-beginners)湮Ͻʽÿ. diff --git a/practices/ch04_first_lines/readme.md b/practices/ch04_first_lines/readme.md index 65268ef..064050a 100644 --- a/practices/ch04_first_lines/readme.md +++ b/practices/ch04_first_lines/readme.md @@ -1,22 +1,22 @@ -# Practice Exercises for first lines of code +# ڵ ù ° ٿ -## Overview +## -In this section, you'll have a chance to practice the concepts you've learned in the videos. First, review the core concepts covered that you'll need to keep in mind. Then go through the exercises below. + ǿ 󿡼 ִ ȸ ־ϴ. , ؾ ٽ غʽÿ. ׷ Ʒ 캸ʽÿ. -Remember, these are for your own benefit. Feel free to skip them if you don't find a particular exercise valuable or you get stuck for too long. +Ͻʽÿ, ̰͵ Դϴ. Ư ġ ٰ ߰ߵǰų ʹ ɷִٸ, װ͵ dzʶپ ϴ. -## Core concepts +## ٽɰ ### REPL -REPL stands for Read-Eval-Print-Loop and is the interactive environment you get when you type `python` in the terminal / command prompt. Remember, on macOS and Linux, you start Python 3's REPL by typing `python3`. +REPL Read-Evaluation-Print-Loop ڷ ͹̳ / Ʈ `python` Է ִ ȭ ȯԴϴ. os `python3` ԷϿ REPL Ѵٴ Ͻʽÿ. -### Variables and values +### -Variables are names that we use to refer to data that could change or is complex to write directly. Values are the data that is currently assigned to that variable. We used [pythontutor.com](http://pythontutor.com) to explore this. + 츮 ְų ⿡ ͸ ϱ ϴ ̸Դϴ. ش Ҵ Դϴ. 츮 ̰ Žϱ [pythontutor.com](http://pythontutor.com) ߽̿ϴ. -Examples: +: ```python x = 7 @@ -25,33 +25,33 @@ z = x + 2*y name = 'Sarah' ``` -### Using built-in libraries +### ⺻ ̺귯 -Python comes with many included libraries ([hundreds!](https://docs.python.org/3/library/)). To use one of these libraries, such as `sys`, you must tell Python you want to load it. This is done with the `import` keyword. +̽ ̺귯 մϴ. ([hundreds!](https://docs.python.org/3/library/)) `sys` ̺귯 ϳ Ϸ ̽㿡 εϰ ʹٰ ؾմϴ. ̰ `import` Ű մϴ. -Example: +: ```python import sys -print(f"The current version of Python is {sys.version_info}") +print(f"̽ {sys.version_info}") ``` -### Getting input from users +### ڷκ Է -Getting input from users is done with the `input` function. +ڷκ Է ޴ `input` Լ ̷ ϴ. Example: ```python -name = input("What is your name? ") +name = input("̸ ? ") print(f"Hello {name}") ``` -#### Converting data +#### ȯ -Certain operations (like math and string concatenation) require the correct data types. +( ڿ ) ùٸ ʿմϴ. -Data is converted to numerical types using the type name (int, float, etc). Here are a few examples: +ʹ (int,float ) Ͽ ȯѴ. ֽϴ. ```python text = '7.2' @@ -59,12 +59,12 @@ number = float(text) # value = 7.2 whole_number = int(number) # value = 7 ``` -## Exercises +## -Now it's your turn. Here are some ideas to practice. + Դϴ.  ֽϴ. -1. Run the Python REPL and verify you have Python 3.6 or higher. -2. Create a variable which is a whole number, compute the square and cube of it (i.e. x^2 and x^3, although that is not the Python code needed). -3. Ask a user for their name and age. Write code to tell them how many years you are older than them (negative numbers for younger is fine at this point). -4. Use the built-in library `datetime` and the function `datetime.datetime.now()` to determine the current year and print that to REPL using an f-string. -5. Take one of these sets of code and visualize them with [pythontutor.com](http://pythontutor.com/visualize.html#mode=edit) +1. ̽ REPL ϰ Python 3.6 ̻ ȮϽʽÿ. +2. ť긦 մϴ.(, x^2 x^3, ʿ ̽ ڵ ƴմϴ.) +3. ̸ ̸ ϴ. ׵鿡 ׵麸 Ծ ˷ִ ڵ带 ۼϽʽÿ. ( ϴ.) +4. ̺귯 `datetime` `datetime.datetime.now()` Լ Ͽ ϰ f-ڿ Ͽ REPL մϴ. +5. ̷ ڵ Ʈ ϳ Ͽ [pythontutor.com](http://pythontutor.com/visualize.html#mode=edit) ðȭմϴ. diff --git a/practices/ch05_interactive_code/readme.md b/practices/ch05_interactive_code/readme.md index 040d097..9ca7488 100644 --- a/practices/ch05_interactive_code/readme.md +++ b/practices/ch05_interactive_code/readme.md @@ -1,84 +1,84 @@ -# Practice exercises for interactive code +# ȭ ڵ忡 ǽ -## Overview +## -In this section, you'll have a chance to practice the concepts you've learned in the videos. First, review the core concepts covered that you'll need to keep in mind. Then go through the exercises below. + ǿ 󿡼 ִ ȸ ־ϴ. , ؾ ٽ غʽÿ. ׷ Ʒ ʽÿ. -Remember, these are for your own benefit. Feel free to skip them if you don't find a particular exercise valuable or you get stuck for too long. +Ͻʽÿ, ̰͵ Դϴ. Ư ġ ٰ ߰ߵǰų ʹ ɷִٸ, װ͵ dzʶپ ϴ. -## Core concepts +## ٽɰ -### Running Python code +### ̽ ڵ -If you have a Python **file**, it can be executed inside PyCharm by simply right-clicking and choosing **Run**. Outside of PyCharm, you execute it like this: +̽ **file** ִ , ܼ ư Ŭϰ **Run** ϸ PyCharm ο ֽϴ. PyCharm ܺο, Ͻʽÿ. ```bash $ python3 program.py -# or +# Ǵ C:\> python program.py ``` -Remember to use either `python` or `python3` based on your system setup. +ý `python` Ǵ `python3` Ͻʽÿ. -### if / else statements +### if / else -The essential lesson from this chapter is how code makes decisions to do one thing or another. The first building block are simple **this or that** type of processes. These are done with `if` statements. + κ ڵ尡  ̷ ϴ° ֽϴ. ù ° **̰̳ ** μ Դϴ. ̰͵ `if` ˴ϴ. ```python num = 7 if num < 100: - print("Number is smallish") + print("ڰ ۽ϴ.") ``` -We can also have code that has two or more branches with `elif` and `else`: +츮 `elif` `else` ̻ б⸦ ڵ带 ֽϴ. : ```python num = 7 if num < 100: - print("Number is smallish") + print("ڰ ۽ϴ.") elif num < 1000: - print("Middle sized number.") + print("߰ Դϴ..") else: - print("That's one big number!") + print("ڰ Ůϴ!") ``` -### while loops +### while -When you need to repeat an operation as long as some condition is met, the `while` loop is the thing you want. + Ǵ ۾ ݺؾ , `while` ʿմϴ. ```python attempts = 0 while attempts < 5: attempts += 1 - # do whatever you are attempting here... + # õϰ ø ˴ϴ.... ``` -### Is a number even or odd? +### ڰ Ȧΰ ¦ΰ? -This seems like a simple question to answer but requires a new operation. The modulo operator. This is basically the remainder of a division. For example, 19 / 5 is 3 as a **whole number** (int). But we know that there is a remainder of 4 for whole number math. In Python we express this as: +̰ ϱ ó ο ʿմϴ. . ̰ ⺻ κԴϴ. , 19 / 5 **** (int)μ 3Դϴ. ׷ 츮 п 4 ִٴ дϴ. ̽㿡 ̸ ǥմϴ: ```python div = int(19 / 5) # <-- 3 rem = 19 % 5 # <-- 4 ``` -Then we can test whether a number is even if it is evenly divisible by 2 or has a remainder of 0: +׷ , ڰ 2 յϰ ҵǰų 0 쿡 ڰ θ ֽϴ.: ```python -remainder = num % 2 # Is this 0 or 1? +remainder = num % 2 # 0ϱ 1ϱ? ``` -## Exercises +## -Now it's your turn. Here are some ideas to practice. + Դϴ.  ֽϴ. -1. Create a **hello_world.py** file and execute it with Python. This can be in PyCharm or in another editor and using the technique above. Seems trivial but will help you verify everything is working right there. Just have the program output "Hello world" -2. Write a program that requests a number from the user. Have the program print "Even" or "Odd" depending on whether they entered an even or odd number. -3. Extend the program above to repeatedly ask that question as long as the user enters a nonzero number. But if they enter 0, it should then stop asking and say goodbye. -4. Take one of these sets of code and visualize them with [pythontutor.com](http://pythontutor.com/visualize.html#mode=edit) +1. **hello_world.py** ̽ ̸ Ͻʽÿ. ̰ PyCharm Ǵ ٸ ⿡ ֽϴ. ۵ϴ Ȯϴ Դϴ. α׷ "Hello world" Ͻʽÿ. +2. ڷκ ڸ ûϴ α׷ ۼϽʽÿ. ¦ Էߴ Ȧ Էߴ ο α׷ "¦" Ǵ "Ȧ" ϵ Ͻʽÿ. +3. α׷ ȮϿ ڰ 0 ƴ ڸ Էϴ ݺ մϴ. ׵ 0 ٸ, װ ߰ ۺλ縦 ؾ մϴ. +4. ̷ ڵ Ʈ ϳ Ͽ [pythontutor.com](http://pythontutor.com/visualize.html#mode=edit) ðȭմϴ. diff --git a/practices/ch06-organizing-code-with-functions/readme.md b/practices/ch06-organizing-code-with-functions/readme.md index daf5c5f..6b471a6 100644 --- a/practices/ch06-organizing-code-with-functions/readme.md +++ b/practices/ch06-organizing-code-with-functions/readme.md @@ -1,42 +1,42 @@ -# Practice exercises for organizing with functions +# Լ Ͽ ϱ -## Overview +## -In this section, you'll have a chance to practice the concepts you've learned in the videos. First, review the core concepts covered that you'll need to keep in mind. Then go through the exercises below. + ǿ 󿡼 ִ ȸ ־ϴ. , ؾ ٽ غʽÿ. ׷ Ʒ ʽÿ. -Remember, these are for your own benefit. Feel free to skip them if you don't find a particular exercise valuable or you get stuck for too long. +Ͻʽÿ, ̰͵ Դϴ. Ư ġ ٰ ߰ߵǰų ʹ ɷִٸ, װ͵ dzʶپ ϴ. -## Core concepts +## ٽɰ -### Function with parameters (input data) +### ĶͿ Լ(Է ) -When we have code that we want to reuse or isolate and treat as a single concept (black box), we define functions. Here is a basic function: +츮 ϰų ݸϿ ϳ (ڽ) ϰ ϴ ڵ尡 , 츮 Լ մϴ. ⺻ Լ ϴ: ```python def say_hello(name): - print(f'Nice to meet you {name}') + print(f' ݰ {name}') ``` -### Function that generates data (return values) +### ͸ ϴ Լ (ϰ) -Functions can also return values to be used later: +Լ ߿ ȯ ֽϴ. ```python def get_name(): - name = input("What is your name? ") + name = input("̸ ? ") return name ``` -We can then use these functions together as follows: +׷ ̷ Բ ֽϴ: ```python person = get_name() say_hello(person) ``` -### A main method and running "the program" +### ֿ ż "α׷" -As we saw, it's a good convention to have an overall organizing function that is what the whole program does at the top of the file. I called this main, for example: +츮 ҵ ü α׷ ܿ ϴ ü ߴ Դϴ. ̰ ҷϴ: ```python def main(): @@ -45,13 +45,13 @@ def main(): # ... ``` -And you must remember to run this **at the end** of your program to actually make it execute. We added these two lines as the final of the source file: +׸ α׷ ϱ ؼ α׷ **** ̰ ϴ ؾ մϴ. ҽ ߽߰ϴ.: ```python if __name__ == "__main__": main() ``` -## Exercises +## -Now it's your turn. Your practice exercise is to **take the M&M guessing game we created back in chapter 5 (interactive code) and clean it up using functions**. Make a copy of the file in this folder called `guessinggame.py`. That's what we started with. There are probably 3-4 functions that you can create to help organize and isolate parts of this application. Use the core concepts above to help. \ No newline at end of file + Դϴ. ̹ **5 忡 M & M (ȭ ڵ) Ͽ ϴ ** Դϴ. `guessinggame.py` 纻 ϴ. װ 츮 Դϴ. α׷ Ϻθ ϰ иϴ ̵Ǵ 3-4 Լ ֽϴ. ٽ Ͽ ʽÿ. diff --git a/practices/ch07_data_structures/readme.md b/practices/ch07_data_structures/readme.md index 95297aa..66fe008 100644 --- a/practices/ch07_data_structures/readme.md +++ b/practices/ch07_data_structures/readme.md @@ -1,33 +1,33 @@ -# Practice exercises for data structures +# -## Overview +## -In this section, you'll have a chance to practice the concepts you've learned in the videos. First, review the core concepts covered that you'll need to keep in mind. Then go through the exercises below. + ǿ 󿡼 ִ ȸ ־ϴ. , ؾ ٽ غʽÿ. ׷ Ʒ ʽÿ. -Remember, these are for your own benefit. Feel free to skip them if you don't find a particular exercise valuable or you get stuck for too long. +Ͻʽÿ, ̰͵ Դϴ. Ư ġ ٰ ߰ߵǰų ʹ ɷִٸ, װ͵ dzʶپ ϴ. -## Core concepts +## ٽɰ -### Creating a static dictionary +### -You can create a dictionary a number of ways. How you do this depends on how much data is static and how much is dynamic as part of the program's execution. + ֽϴ. ۾ ϴ α׷ Ϻημ 翡 ޶ϴ. ```python -# Static data styles: +# Ÿ: -# empty dictionary +# names = {} -# A dictionary with players start at zero score +# ÷̾ 0 ϴ two_names = {'player1': 0, 'player2': 0} -# This is the same as before +# ̰ մϴ. two_names = dict(player1=0, player2=0) ``` -### Creating a dynamic dictionary +### -If you have dynamic data, this requires something else to build them: + Ͱ ִ ͸ ۼϷ ٸ ۾ ʿմϴ: ```python names = get_list_of_names() @@ -35,34 +35,34 @@ scores = {} for n in names: scores[n] = 0 -# We can condense this using a dictionary comprehension. -# Same as above: +# ط Ͽ ̰ ֽϴ. +# : names = get_list_of_names() scores = {n: 0 for n in names} ``` -### Reading values from a dictionary +### б ```python -# Access a *known* value in the dictionary: +# ִ *˷* ׼մϴ.: p1_score = scores['player1'] -# Access a score, unsure whether player1 is a key, if it isn't there, return 0. +# ׼ϰ player1 Ű Ȯ 0 ȯմϴ. p1_score = scores.get('player1', 0) ``` -## Exercises +## -Now it's your turn. Try this practice below. + Դϴ. Ʒ õϽʽÿ. -The core idea in this chapter was about dictionaries and data structures in general. Create a simple program that creates a dictionary called `d` such that the following runs without error and prints what is expected: + ٽ ̵ ̾ϴ. ǰ Ǵ μ ֵ `d` α׷ ʽÿ. ```python -# d = create d using core concepts above. +# d = ٽ Ͽ d . -print(d["Sam"]) # outputs 7 -print(d['rolls']) # outputs ['rock', 'paper', 'scissors'] -print(d.get('Sarah')) # outputs None -print(d.get('Jeff', -1)) # outputs -1 -print(d['done']) # outputs True +print(d["Sam"]) # 7 +print(d['rolls']) # ['rock', 'paper', 'scissors'] +print(d.get('Sarah')) # None +print(d.get('Jeff', -1)) # -1 +print(d['done']) # True ``` diff --git a/practices/ch08_problem_solving/readme.md b/practices/ch08_problem_solving/readme.md index 26e259b..f1f7476 100644 --- a/practices/ch08_problem_solving/readme.md +++ b/practices/ch08_problem_solving/readme.md @@ -1,36 +1,36 @@ -# Practice Exercises for problem solving +# ذ -## Overview +## -In this section, you'll have a chance to practice the concepts you've learned in the videos. First, review the core concepts covered that you'll need to keep in mind. Then go through the exercises below. + ǿ 󿡼 ִ ȸ ־ϴ. , ؾ ٽ غʽÿ. ׷ Ʒ ʽÿ. -Remember, these are for your own benefit. Feel free to skip them if you don't find a particular exercise valuable or you get stuck for too long. +Ͻʽÿ, ̰͵ Դϴ. Ư ġ ٰ ߰ߵǰų ʹ ɷִٸ, װ͵ dzʶپ ϴ. -## Core concepts +## ٽɰ -### Michael's problem solving techniques +### Ŭ ذ -Here are a few of the ideas I use to get traction while solving a problem + ذϸ鼭 ϴ ̵ ִ. -1. Divide and conquer. -2. Have I seen a similar problem before? -3. Visualize the data ([pythontutor.com](http://pythontutor.com), debugger, `print()`, etc) -4. Run through the data structures (will a well known data structure help this problem?). -5. Is there a [PyPI](https://pypi.org/) package that solves this? Also check [awesome-python](https://awesome-python.com/). -6. Remember this is **part of the journey**. -7. **Just start**, you can adjust as you go and learn more. +1. пϿ ϶ +2. ִ°? +3. ͸ ðȭϿ. ([pythontutor.com](http://pythontutor.com), , `print()`, ) +4. Ѵ( ˷ ΰ). +5. ذϴ [PyPI](https://pypi.org/) Ű ֽϱ? [awesome-python](https://awesome-python.com/) ȮϽʽÿ . +6. ̰ ** Ϻ**.Ͻʽÿ. +7. **ϱ⸸ ϸ**, ϸ鼭 ϰ ڼ ˾ƺ ֽϴ. -## Exercises +## -Now it's your turn. For this round, you get to dive into a similar experience as we had building [**Tic Tac Toe**](https://www.google.com/search?client=firefox-b-1-d&q=Tic+Tac+Toe) in the videos. + Դϴ. ̹ 忡 [**Tic Tac Toe**](https://www.google.com/search?client=firefox-b-1-d&q=Tic+Tac+Toe) ֽϴ. ![](readme_files/Connect_4_Board_and_Box.jpg) -You get to build a **Connect 4** clone. Read more about the game **[on Wikipedia](https://en.wikipedia.org/wiki/Connect_Four)** or try a few rounds over at **[this website](https://www.mathsisfun.com/games/connect4.html)**. +**Connect 4** Ŭ ֽϴ. **[Wikipedia](https://en.wikipedia.org/wiki/Connect_Four)** ӿ ڼ о ų **[this website](https://www.mathsisfun.com/games/connect4.html)** ݺ ʽÿ. -It should be pretty similar to tic tac toe. But the way a player selects a play is just to choose the column and the state of the board determines which row the puck stops in. Also, you do not need an entire row, column, or diagonal to win, just 4 of a given kind in any of these. +tic tac toe մϴ. ׷ ÷̾ ÷̸ ϴ ϴ ̸ ¿ ߴ ˴ϴ. , ̱ ü , Ǵ 밢 ʿ ʽϴ. ̰͵ Ϳ ־ 4 ʿմϴ. -Think about what you saw in the videos (**#2, have I seen a similar solution**), use the right data structure (**#4, Run through the data structures**), and as always, break the problem down to simple parts (**#1, Divide and conquer**). + ʽÿ.(**#2, ַ ִ°**). ùٸ Ͻʽÿ. (**#4, Ͻʽÿ**). ׸ ׻ ׷ ܼ κ ʽÿ.(**#1, ***). -Also, remember that writing this program is involved. Most likely, it won't be super fast to solve (**#6, this is part of the journey**). Now, create a new blank project and start coding (**#7, just start**)! \ No newline at end of file + α׷ ۼϴ ͵ Եȴٴ Ͻʽÿ. κ ذϴ ׷ Դϴ. (**#6, ̰ ϺԴϴ.**). Ʈ ڵ Ͻʽÿ. (**#7, Ͻʽÿ **)! \ No newline at end of file diff --git a/practices/ch09_working_with_files/readme.md b/practices/ch09_working_with_files/readme.md index a33fb78..83f9b8f 100644 --- a/practices/ch09_working_with_files/readme.md +++ b/practices/ch09_working_with_files/readme.md @@ -1,61 +1,61 @@ -# Practice Exercises for file I/O +# -## Overview +## -In this section, you'll have a chance to practice the concepts you've learned in the videos. First, review the core concepts covered that you'll need to keep in mind. Then go through the exercises below. + ǿ 󿡼 ִ ȸ ־ϴ. , ؾ ٽ غʽÿ. ׷ Ʒ ʽÿ. -Remember, these are for your own benefit. Feel free to skip them if you don't find a particular exercise valuable or you get stuck for too long. +Ͻʽÿ, ̰͵ Դϴ. Ư ġ ٰ ߰ߵǰų ʹ ɷִٸ, װ͵ dzʶپ ϴ. -## Core concepts +## ٽɰ -### Determining the full path to a file +### Ͽ ü -Remember that the file location when loading files like `the_file.txt` depend on the working directory, which your program probably doesn't control. So we need to use the `os` module to work from known locations. + ε ġ `the_file.txt` α׷ ʴ ۾ 丮 ٸϴ. os˷ ġ ۾Ϸ ؾ մϴ . ```python directory = os.path.dirname(__file__) filename = os.path.join(directory, 'the_file.txt') -# Now filename is a full path +# filename ü Դϴ. ``` -### Opening a file for reading +### б 뵵 -To open a file we use, well, the `open()` function. But as we saw, we should do this within a `with` block to ensure it's closed and flushed in a timely manner. Note the **r** passed to open for read. +츮 ؼ, `open()` Լ մϴ. ׷ 츮 ó `with` ۾ Ͽ ÿ ÷õǵ ؾ մϴ. б 뵵 ޵ `with` Ͻʽÿ. ```python with open(filename, 'r', encoding='utf-8') as fin: # work with fin here -# fin is closed and useless at this point. +# fin ϴ. ``` -### Writing to a file +### Ͽ -Writing to a file is similar to reading, it's just about how you open it. Note the **w** for write and **fout** to tell us that it's an output not input file stream. +Ͽ д Ͱ մϴ, װ  ΰ Դϴ. **w** Է Ʈ ƴ Ʈ ˷ֱ **fout** νʽÿ. ```python with open(filename, 'w', encoding='utf-8') as fout: - # work with four here + # ⼭ ۾ ``` -### Using json module with file streams +### Ʈ Բ json + + Ʈ ־ json json Ŀ ü аų ֽϴ. -Given a file stream, json can read or write objects to/from the json file format. ```python import json -# load the rolls from fin input stream +# fin Է Ʈ εմϴ. rolls = json.load(fin) -# save the leader dictionary to the fout file stream +# fout Ʈ մϴ. json.dump(leaders, fout) ``` -## Exercises - -Now it's your turn. In this practice, go back to the tic tac toe game we created back in the chapter on problem solving. Alternatively, if you made it through Connect 4, you can work with that one instead. Your job will be to: +## -* Add a leader board (feel free to use JSON like we did). -* Add a running log file (test with `tail -n 20 -f FILENAME` on macOS and Linux, just open in PyCharm on Windows and it'll change). -* For extra credit, you can try to use [LogBook](https://logbook.readthedocs.io/en/stable/) to improve the logging (but it will require a few concepts we haven't covered yet). \ No newline at end of file + Դϴ. ذῡ 忡 tic tac toe ưϴ. Ǵ Connect 4 ش ۾ ֽϴ. ϴ: +* 带 ߰Ͻʽÿ. (츮ߴ ó JSON Ӱ Ͻʽÿ). +* α ߰մϴ. (os `tail -n 20 -f FILENAME` ׽Ʈϰ PyCharm ˴ϴ.). +* ߰ ũ , [LogBook](https://logbook.readthedocs.io/en/stable/) Ͽ α ֽϴ. (׷ ٷ ʿմϴ.) \ No newline at end of file diff --git a/practices/ch10_external_libraries/readme.md b/practices/ch10_external_libraries/readme.md index b6a0de1..0b28241 100644 --- a/practices/ch10_external_libraries/readme.md +++ b/practices/ch10_external_libraries/readme.md @@ -1,40 +1,38 @@ -# Practice Exercises for external packages +# 외부 패키지에 대한 연습 문제 -## Overview +## 개요 -In this section, you'll have a chance to practice the concepts you've learned in the videos. First, review the core concepts covered that you'll need to keep in mind. Then go through the exercises below. +이 섹션에서는 동영상에서 배운 개념을 연습할 수 있는 기회가 주어집니다. 먼저, 여러분이 유념해야 할 핵심 개념들을 검토해보십시오. 그런 다음 아래의 연습문제를 보십시오. -Remember, these are for your own benefit. Feel free to skip them if you don't find a particular exercise valuable or you get stuck for too long. +기억하십시오, 이것들은 여러분의 이익을 위한 것입니다. 만약 여러분이 특정한 연습이 가치가 없다고 발견되거나 너무 오랫동안 걸려있다면, 그것들을 건너뛰어도 좋습니다. -## Core concepts +## 핵심개념 ### requirements.txt - -When working with an application that uses external packages, you need to communicate what packages are required for it to run. We do this with a `requiements.txt` file, here is an example: +외부 패키지를 사용하는 애플리케이션으로 작업 할 때 실행하는 데 필요한 패키지를 전달해야합니다. `requiements.txt` 파일로 이 작업을 수행합니다 . 예는 다음과 같습니다: ``` colorama prompt_toolkit ``` -Once you have a virtual environment active, you can install all the dependencies with this command: +가상 환경이 활성화되면 다음 명령을 사용하여 모든 종속성을 설치할 수 있습니다. ``` (env) C:\> pip install -r requirements.txt ``` -### Virtual environments - -Virtual environments are key to having different versions of the same library coexisting on your computer. You create one as follows: +### 가상환경 -#### macOS / Linux +가상 환경은 컴퓨터에 동일한 라이브러리의 여러 버전이 공존하는 데있어 핵심입니다. 다음과 같이 만듭니다. +#### 맥os / 리눅스 ``` $ python3 –m venv venv $ . venv/bin/activate ``` -#### Windows +#### 윈도우 ``` C:\> python –m venv venv @@ -43,8 +41,7 @@ C:\> venv\scripts\activate ### pip -Pip is the tool you use on the command line to install and view external packages. Here are some examples: - +Pip은 외부 패키지를 설치하고보기 위해 명령 줄에서 사용하는 도구입니다. 여기 예시들이 있습니다 : ```bash $ pip list $ pip install colorama @@ -52,12 +49,12 @@ $ pip install -r requirements.txt $ pip uninstall requests ``` -## Exercises +## 연습 -Now it's your turn. In this practice, go back to the tic tac toe game we created back in the chapter on problem solving. Alternatively, if you made it through Connect 4, you can work with that one instead. Your job will be to: +이제 여러분 차례입니다. 이 연습에서는 문제 해결에 관한 장에서 만든 tic tac toe 게임으로 돌아갑니다. 또는 Connect 4를 통해 만든 경우 대신 해당 작업을 수행 할 수 있습니다. 당신이 할 일은 다음과 같습니다: -* Create a virtual environment. -* Set it as the active python interpreter in PyCharm under `settings > project > project interpreter`. -* Create a requirements.txt file with `colorama` as a dependency. -* Install the requirements with `pip`. -* Use `colorama` to add colored output to your game. \ No newline at end of file +* 가상 환경을 만듭니다. +* 아래의 PyCharm에서 호라성 파이썬 이터프리터로 설정하십시오. `settings > project > project interpreter`. +* `colorama` 의 종속성으로 requirements.txt 파일을 만듭시오. +* `pip`을 사용하여 요구 사항을 설치합니다. +* 게임에 컬러 출력을 추가하는 데 `colorama`을 사용합니다. \ No newline at end of file diff --git a/practices/ch11-error-handling/readme.md b/practices/ch11-error-handling/readme.md index ffdc8c6..a7dbf34 100644 --- a/practices/ch11-error-handling/readme.md +++ b/practices/ch11-error-handling/readme.md @@ -1,18 +1,19 @@ -# Practice Exercises for error handling +# ó -## Overview +## -In this section, you'll have a chance to practice the concepts you've learned in the videos. First, review the core concepts covered that you'll need to keep in mind. Then go through the exercises below. + ǿ 󿡼 ִ ȸ ־ϴ. , ؾ ٽ غʽÿ. ׷ Ʒ ʽÿ. -Remember, these are for your own benefit. Feel free to skip them if you don't find a particular exercise valuable or you get stuck for too long. +Ͻʽÿ, ̰͵ Դϴ. Ư ġ ٰ ߰ߵǰų ʹ ɷִٸ, װ͵ dzʶپ ϴ. -## Core concepts +## ٽɰ ### try / except -When handling errors, we can check for bad values (e.g. `None` where a proper string was expected). But Python's native error handling approach is exception-based: throwing and catching exceptions. + ó ߸ Ȯ ֽϴ. (: `None` ڿ Ǵ ġ) ׷ Python ⺻ ó Դϴ. ߻ . + + Python ϱ ּ ڵԴϴ. -Below is the minimum code to catch an error in Python. ```python try: @@ -20,14 +21,15 @@ try: do_risky_thing2() do_risky_thing3() except Exception as x: - # Deal with error, use x for help on what happened. + # ־ ޱ x Ͽ óϽʽÿ. ``` -### Multiple error types +### + + ϴ ϴ. ׷ װ װ͵ ( ) ϰ, װ͵ ϰ մϴ. -The example above is good to catch errors. But it catches them all (well, almost all of them), and it treats them all the same. + پ ġ óϴµ ʿ ڵԴϴ. -Below is code needed to handle different errors as well as unforeseen errors. ```python try: @@ -44,11 +46,11 @@ except Exception as x: # Deal with error, use x for help on what happened. ``` -**Note**: It is important that the most specific errors are listed first and the most general the last (`Exception`). Python selects the first (not best) match. +****: ü ǰ Ϲ ( Exception) Ǵ ߿մϴ . ̽ ù ° (ּ ƴ) ġ մϴ. -## Exercises +## -Now it's your turn. In this practice, go back to the tic tac toe game we created back in the chapter on problem solving. Alternatively, if you made it through Connect 4, you can work with that one instead. Your job will be to: + Դϴ. ذῡ 忡 tic tac toe ưϴ. Ǵ Connect 4 ش ۾ ֽϴ. ϴ: -* Add error handling around the input processing in your program using try / except. Be as specific on the errors as possible. If you can determine the cause or type of error, give a specific message. -* Think of all other ways your app could crash or run into trouble. Get it to crash, check the error type in the traceback, and add the appropriate error handling for this as well. \ No newline at end of file +* try / except Ͽ α׷ Է ó ó ߰Ͻʽÿ. ü Ͻʽÿ. ̳ Ȯ Ư ޽ Ͻʽÿ. +* 浹ϰų ߻ ִ ٸ غʽÿ. 浹 Ű Ʈ̽ 鿡 Ȯϰ ̿ ó ߰Ͻʽÿ. \ No newline at end of file diff --git a/practices/readme.md b/practices/readme.md index 82de9c4..3209ba8 100644 --- a/practices/readme.md +++ b/practices/readme.md @@ -1,13 +1,13 @@ -# Practice Exercises +# -* [Chapter 4: First lines of code](ch04_first_lines/readme.md) -* [Chapter 5: Interactive code](ch05_interactive_code/readme.md) -* [Chapter 6: Functions](ch06-organizing-code-with-functions/readme.md) -* [Chapter 7: Data structures](ch07_data_structures/readme.md) -* [Chapter 8: Problem solving](ch08_problem_solving/readme.md) -* [Chapter 9: Working with files](ch09_working_with_files/readme.md) -* [Chapter 10: External libraries](ch10_external_libraries/readme.md) -* [Chapter 11: Error handling](ch11-error-handling/readme.md) +* [Chapter 4: ڵ ù ](ch04_first_lines/readme.md) +* [Chapter 5: ȭ ڵ](ch05_interactive_code/readme.md) +* [Chapter 6: Լ](ch06-organizing-code-with-functions/readme.md) +* [Chapter 7: ](ch07_data_structures/readme.md) +* [Chapter 8: ذ](ch08_problem_solving/readme.md) +* [Chapter 9: ۾](ch09_working_with_files/readme.md) +* [Chapter 10: ܺ ̺귯](ch10_external_libraries/readme.md) +* [Chapter 11: ó](ch11-error-handling/readme.md) diff --git a/solutions/readme.md b/solutions/readme.md index 6245c59..3229c7c 100644 --- a/solutions/readme.md +++ b/solutions/readme.md @@ -1,15 +1,17 @@ -# Solutions: Proceed with caution. +# ذå :ؼ Ͻʽÿ. -We've decided to include the solutions to the practice exercises. Initially, the intention was to omit them. It can be frustrating. However, **it's working your way through that actually drives the learning**. It feels good to see the solution, but to make it really click, you have to make it your own and work your way through it. + ַ ϱ ߽ϴ. ó̸ Ϸ ǵϴ. Ǹ ֽϴ. ׷ ** н ֵϴ ۵մϴ** . ذå , ŬϰϷ ڽ ذؾմϴ. -That said, a large number of students have requested that I add these and so here they are. +, л ̰ ߰ϵ û ⿡ ֽϴ. -But, I want to you be sure you want to go down this path. Ideally, this is a *check my solution* type of thing. So we have made the steps a little bit manual. To see the solution, you have to check out the `with_solutions` branch. They do no appear in the default `master` branch (this one). +׷ е ʹٴ Ȯϰ ͽϴ. ̻ ̰ * ַ Ȯ* ϴ Դϴ. ׷ 츮 ܰ踦 ణ ϴ. ذå `with_solutions`귣ġ Ȯؾմϴ . ⺻ `master`귣ġ ( 귣ġ) Ÿ ʽϴ . + + б ٿ Ͽ GitHub ۾ ֽϴ. -You can do this on GitHub by just using the branch dropdown like this: ![](./resources/branches.png) -Then you will see a solutions folder below this one. +׷ Ʒ ַ ǥõ˴ϴ. + -Best of luck on the course, Michael! \ No newline at end of file + ϴ, Ŭ! \ No newline at end of file