9 – Reading And Writing Files

In order for a program to be really useful, it needs to interact with real-world data. Images, web pages, and databases are all examples of files, and we routinely create, move, manipulate, and read these files in our daily digital lives. All the data we’ve used so far has been defined inside the Python script … Read more

8 – Handling Error Specifying Exceptions

Here, the code in the except block occurs when any kind of exception occurs while executing the try block. Really though we just want to adjust the ValueError exception. If I try to exit the program with Ctrl C, it doesn’t stop the program because the except handles any error, including the KeyboardInterrupt error. We … Read more

7 – Handling Errors Try Except Finally

In Python, there are ways to handle exceptions so they don’t always crush our program when they occur. Let’s look back at this example that takes an input from the user. We saw that when we ran this code, it got an error when the user input something that can’t be converted to an int. … Read more

6 – Errors And Exceptions

As you saw in the last video, trying to handle every kind of scenario when dealing with unexpected input can be a bit much. There’s actually a much simpler way of dealing with this in Python. Here, you learn how to handle errors with try and except blocks. First, let’s learn more about what errors … Read more

5 – Scripting With Raw Input

Now that you have your local program environment all set up, it’s time to try out different inputs. Programs can get a lot more interesting when they can interact with external information. First, let’s try getting raw input from the user. Here’s what I mean. This program prompts the user to enter a name, and … Read more

4 – Programming Environment Setup

There are many ways to setup a programming environment and there isn’t a right or wrong way to go about it. However, if you’re just starting out programming in Python, you might like to see this setup to get some ideas. Over here is a text editor. This particular editor is called atom. But there … Read more

3 – Running A Python Script

Now that you’ve successfully installed Python, let’s try to run a script in your terminal. First, download the file first_script.py attached at the bottom of this page and move it to an appropriate directory. I put my file here by dragging it from the downloads folder to this folder. This might be a good time … Read more

2 – Python Installation

In all of the previous lessons, we’ve been using these boxes to represent a code editor where we wrote our Python code and output window where we viewed results. And in the classroom, you use these programming quizzes to write Python and run your code but instead of running your code online in the classroom, … Read more

17 – Experimenting With An Interpreter4

If you open your terminal and type python, you should see something like this. This is the python interactive interpreter. You can type here to interact with Python directly. You just type your code, press enter and the output will appear on the following line. This is a good place to experiment and try bits … Read more

17 – Experimenting With An Interpreter

If you open your terminal and type python, you should see something like this. This is the python interactive interpreter. You can type here to interact with Python directly. You just type your code, press enter and the output will appear on the following line. This is a good place to experiment and try bits … Read more

16 – Third Party Libraries And Package Managers

Compared to most languages, Python has a large standard library. In fact, people say Python comes with batteries included because it comes with the libraries you need to get right to work. However, the standard library doesn’t come with everything you might want. Some tasks are too specialized to be accommodated by the standard library. … Read more

15 – Techniques For Importing Modules Part II

Some of the modules in the Python Standard Library have a lot in them. In order to manage the code better, they’re split down into sub-modules that are contained within a package. A package is simply a module that contains sub-modules. A sub-module is specified with the usual dot notation. For example, the OS module, … Read more

14 – Techniques For Importing Modules

So far, you’ve imported modules with import followed by the module name, which makes all the classes of objects and functions of that module available via.notation. There are some other variance of importing that are useful in other situations. You can import an individual function or class from a module like this, from, the module … Read more

13 – The Standard Library

You’ve seen how helpful it could be to import your own modules. But what if I told you there was an entire library of built-in modules that just come with Python? This is the Python standard library. Up here, you see built-in objects we use throughout this course; like built-in functions, data types, and exceptions. … Read more

12 – Importing Files

In addition to reading in data from files, we can actually import Python code from other scripts. This is especially helpful if you’re working on a bigger project where you want to organize your code into multiple files and reuse code in those files. If the Python script you want to import is in the … Read more

11 – Reading And Writing Files Using With

It could be easy to forget to close a file when you’re done using it. So Python provides a special syntax that auto closes it. This with keyword allows you to open a file, do operations on it, and automatically close it after the indented code is executed, in this case, reading from the file. … Read more

10 – Reading And Writing Files Part II

Let’s see how we read information from a file into Python. To read from a file, we first need to open it, which we can accomplish with the built-in function open. We include a string with the path to the file along with any optional parameters we want to specify. The open function returns a … Read more

1 – Scripting

Welcome to this lesson on scripting. Here, you’ll learn how to combine all the concepts you’ve learned throughout this course to write and run your own scripts locally on your computer. You’ll learn about good scripting practices, working with raw input from users, reading and writing files, handling errors, importing local scripts, and working with … Read more

3-1-5-29. Conclusion

Awesome job completing this course. After covering lessons on Python data types and operators, control flow, functions, and scripting, you’ve developed the understanding and skills necessary to tackle projects and courses in Python. Congratulations again on completing this course. 이 과정을 완료한 멋진 작업입니다. Python 데이터 유형 및 연산자, 제어 흐름, 함수, 스크립팅을 통해 이해도를 … Read more