Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,370 --> 00:00:02,480
Welcome back.
2
00:00:02,510 --> 00:00:06,890
In this lecture, I'll show you how to create and run Python scripts.
3
00:00:06,920 --> 00:00:14,900
In picture, a Python script is nothing more than a text file with the dot py extension that contains
4
00:00:14,900 --> 00:00:23,990
python code PI charm is probably the most popular integrated development environment or IDE for python.
5
00:00:24,290 --> 00:00:33,470
It includes great features such as excellent code completion and inspection with advanced debugger and
6
00:00:33,470 --> 00:00:41,810
support for web programming and various frameworks such as Django and Flask will use PI charm throughout
7
00:00:41,810 --> 00:00:42,620
this course.
8
00:00:45,940 --> 00:00:51,670
Let's open picture them and create a project called simply Python Bootcamp.
9
00:00:51,850 --> 00:00:54,130
Using Pi charm is simple.
10
00:00:54,160 --> 00:01:00,940
Basically, you create one or more projects and inside each project you create Python scripts.
11
00:01:01,420 --> 00:01:06,040
These are text files with that PI extension.
12
00:01:06,220 --> 00:01:09,490
A project is a directory in your file system.
13
00:01:12,240 --> 00:01:15,960
My new project will be called Python Bootcamp.
14
00:01:17,390 --> 00:01:24,650
For each project, Chime will create a virtual environment, which is an isolated working environment.
15
00:01:26,000 --> 00:01:27,710
You can leave this option clicked.
16
00:01:27,740 --> 00:01:30,950
Create a main dot pi welcome script or not?
17
00:01:30,980 --> 00:01:33,140
It doesn't matter at all.
18
00:01:39,230 --> 00:01:41,810
It's creating the virtual environment.
19
00:01:42,610 --> 00:01:48,730
After creating the project, I'll right click with the mouse on the project name.
20
00:01:49,420 --> 00:01:50,590
Then new.
21
00:01:51,290 --> 00:01:52,760
In the python file.
22
00:01:54,560 --> 00:01:58,850
And I'll create a file called my script.
23
00:02:03,540 --> 00:02:12,210
If I write my script, it will in fact create a file called my script that by the date by extension
24
00:02:12,210 --> 00:02:14,430
was automatically added.
25
00:02:17,770 --> 00:02:19,180
Before running the script.
26
00:02:19,180 --> 00:02:25,900
I have to wait a few seconds until it finishes indexing the project.
27
00:02:28,630 --> 00:02:29,800
It's almost done.
28
00:02:31,560 --> 00:02:34,200
I am adding a few python statements.
29
00:02:35,280 --> 00:02:37,140
Hello Python world.
30
00:02:41,290 --> 00:02:42,940
And the x equals ten.
31
00:02:43,840 --> 00:02:46,780
There are several options to run a script.
32
00:02:47,590 --> 00:02:54,460
Right click with the mouse everywhere in the Python script and then click on one.
33
00:02:54,640 --> 00:02:56,750
And the name of the script.
34
00:02:56,770 --> 00:02:58,480
So run my script.
35
00:03:01,050 --> 00:03:04,770
And we see the output of the script in the run window.
36
00:03:06,060 --> 00:03:10,720
Or go to run menu and then run in the name of the script.
37
00:03:10,740 --> 00:03:12,510
So run my script.
38
00:03:14,900 --> 00:03:20,090
There is also a shortcut, which is by default the shift F10.
39
00:03:20,600 --> 00:03:29,510
Of course you can change the shortcut or any other aspect of bike charm by going to file in the settings.
40
00:03:42,100 --> 00:03:46,570
Let's go ahead and see how to run only a part of your code.
41
00:03:46,720 --> 00:03:53,470
I'm adding a few lines of code A equals ten and the print eight times two.
42
00:03:54,690 --> 00:03:56,670
B equals 20.
43
00:03:56,730 --> 00:03:58,080
And the print.
44
00:03:58,320 --> 00:03:59,700
B times.
45
00:04:03,250 --> 00:04:11,260
And finally C equals 30 and print c times C.
46
00:04:14,360 --> 00:04:16,040
Of course I can run.
47
00:04:16,040 --> 00:04:19,550
The entire script is I have already shown you.
48
00:04:20,329 --> 00:04:27,290
Let's suppose I don't want to run the entire script, but only these two lines of code.
49
00:04:28,120 --> 00:04:31,030
I just want to test a small part of the script.
50
00:04:31,060 --> 00:04:32,380
How can I do that?
51
00:04:32,980 --> 00:04:34,360
It's really simple.
52
00:04:34,390 --> 00:04:38,830
All I have to do is select the lines I want to run.
53
00:04:39,190 --> 00:04:39,640
Right.
54
00:04:39,640 --> 00:04:46,360
Click anywhere on the selection and then click execute selection in Python.
55
00:04:46,360 --> 00:04:47,080
Cancel.
56
00:04:48,490 --> 00:04:52,210
And only the selected lines of code were run.
57
00:04:53,670 --> 00:04:58,890
Note that there is a shortcut for this alt shift and e.
58
00:05:00,190 --> 00:05:04,780
However, I don't find it handy, so you might want to change it.
59
00:05:05,320 --> 00:05:09,430
Go to file settings and the key map.
60
00:05:10,400 --> 00:05:13,970
And here search for execute selection.
61
00:05:16,800 --> 00:05:20,850
This is the shortcut for that action and you can change it.
62
00:05:26,060 --> 00:05:29,480
By the way, here you can change any other shortcuts.
63
00:05:30,880 --> 00:05:33,940
The basis for running Python scripts using picture.
64
00:05:33,970 --> 00:05:39,460
In the next video, I'll show you how to run Python scripts using the command line.
65
00:05:39,490 --> 00:05:40,570
I'll see you soon.
5598
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.