All language subtitles for 006 Creating and Executing a Python Program on Mac-subtitle-en

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

1

Hey welcome to this new lecture and in

this lecture I'm going to show you how

3

to create and execute a Python program

on a Mac computer, so if you are a

5

Windows user please skip this lecture.

And so in the previous lecture I showed

7

you how to install Python 3 and also how

to launch a Python 3 interactive

9

Session, so which is good for executing

and testing out code so like that line.

11

Like my line, but if you quit the terminal

you're going to lose that code, so you

13

want to find out a way to save that code

in a file so that you can develop your

15

program step by step, so you can go back

to your code, add the code, modify it, and

17

most importantly you can execute

multiple lines at once instead of

19

executing line by line interactively.

So let's go ahead and do that.

21

Normally you need to figure out,

to create a directory where you want to

23

save your program, so I'm going to create

this folder in here and this is empty

25

for now, so I'm going to create a

file there. There may be different ways

27

of creating a Python file all but I prefer

to do it via the terminal.

29

So currently you do PWD, that will print

out the current directory of the terminal,

31

so the terminal is an app and it is

opened in the current directory, in a certain

33

directory which is this on for the

moment. If you do ls you will see the

35

directories and files or the current

Directory, so users admin has this

37

directors, has these folders so if you

want to go to the desktop folder,

39

you'd want to do

desktop or you can use the Tab for auto

41

Completion, so the tab key and then Un Tab.

That will take you to the

43

untitled folder. Execute and I'll see

that your current folder is the untitled

45

folder and that means you can go ahead

and create a file now. Let's say touch my

47

program dot py, so you can give it

any name that you want. Execute and that

49

will create an empty file which for now

you can go ahead and edit it with text

51

edit for example. Later on we're going

to install Atom editor which is much

53

more advanced than this simple editor

but for now this should be enough to

55

just get you started to get you the

idea on how to execute a Python program

57

so let create code for the program.

This program will simply

59

print out the hello text so you need, you

use this print keyword and then you use

61

double quotes and then the text hello and

then another double quote to close the

63

text and then a closing bracket.

65

CTRL S to save, exit text edit and then

go back to the terminal and what you do

67

here now to execute your program, the

program that you just created, you use the

69

Python 3 command and then my, you can

type my program dot py or you can use

71

tab to autocomplete the name, enter to

execute and you get the output of the program.

73

Print it out in the terminal so in this

case the output is hello and yeah that's how

75

you create and execute a program on Mac

and similarly you can go ahead and

77

create other Python programs in here just

as we did with my program dot py. I can also

79

show you a quick way to actually open

the terminal in this current directory

81

without having to do CD and try the

path name, so let's do that.

83

You go here, system preferences, so this is a

one time configuration. Go to keyboard.

85

Shortcuts and then in the shortcuts tab

you go to services, scroll down and see

87

you probably have this option

unchecked, so you want to make sure you

89

have checked the new terminal at folder

option just like I have it here, so make

91

sure make sure that is checked. Close

this and then what you do is to open the

93

terminal in a current folder, in a

specific folder you right click on

95

folder and then go to New Terminal at

Folder and now what you do is Python 3

97

Myprogram.py, execute and you get the

Output, so that's a quick way to open

99

the terminal in a specific folder and

yeah that's about this lecture.

101

I hope everything went smoothly and I'll

talk to you later. Thanks.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.