RUVIDEO
Поделитесь видео 🙏

#4 Python Playground: Program with File | Computer Programming & Coding for Kids & Beginners

Lesson 4

How to Create Simple Program with File

Liam
How to Create Simple Program with File

Emma
Hey Liam.
It's not what I expected.

Liam
Why?

Emma
When I entered the code into the IDLE, it just displayed the output below it.

Liam
Because we've been working in a "shell window", so we just see the output below the code.
IDLE is called "Interactive Interpreter" because you type code and it's done right away.

Emma
But this is troublesome because I have to instruct each time.

Liam
That's true.
Ordinary programs are created in a different way.
We write the whole program in a file in advance and then run it.

Emma
It's kinda like programming.

Liam
Let’s Create Simple Greeting Program!

Now, let's write the program in a file and let it run.
There are three main steps.

1. Create a new file and write a program.
2. Save the file.
3. Run the program.

Emma
OK! There are three steps.

Liam
So, let's start by creating a new file.
Select “New File” from the File menu.

Then a window to enter the program will appear.
We will enter the program here.

Emma
OK. I opened the new window to enter the program.

Liam
Next, we will enter the program.
Let's enter the following two-line program.

print("Hi, Emma!")
print("How are you?")

Emma
OK. I entered the program in the file.

Liam
Next, save the file.
Select “Save” from the File menu.
Enter a file name in the Save As field, select a save location, and click the Save button.
The extension of a Python file is “dot py", so add “dot py" to the end of the name, for example hello dot py.

Emma
What is the extension?

Liam
There are various types of files on your computer.
In order to distinguish the type, the distinguishing symbol at the end of the file name is called "extension".

Emma
I understand that the extension is a symbol to indicate the type of file.

Liam
Exactly!
For Python, add “dot py" as the extension at the end of the file name.

Now, let's run the program we saved!
Select “Run Module” from the Run menu.
Then Python will show you a greeting.

Emma
Yay! Python greeted me!
But I thought it would show up just below the program I wrote, but it shows up in a different window.

Liam
That's right.
The program file is where you write the program, and it's separate from the output.
The program is written in "file" and the program is executed in "shell window".

Emma
I understand very well.
By the way, how do I open the saved program again?

Liam
All you have to do is select the saved file and open it.
First, let's select “Open” from the File menu.
Next, select File from the saved location and click the Open button.

Emma
The saved file opened properly.
In this lesson, I learned how to create and run a program file.

Liam
Well done.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «#4 Python Playground: Program with File | Computer Programming & Coding for Kids & Beginners», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.