rootblysub
All videosYouTube Subtitle Translation한국어

Python Print Function: Visually Explained | #Python Course 4

0:00
Rendben, barátaim, most a Python legelső parancsáról és a Python-projektekben mindenütt előforduló, leggyakrabban használt kódrészletről lesz szó.
All right friends, so now we're going to talk about the very first command in Python and the most used piece of code that you will see everywhere in Python projects.
0:08
A print függvényről beszélünk. Mi az a print?
We are talking about the print function. So what is print?
0:12
A print egy beépített Python-függvény, amely szöveget vagy eredményt jelenít meg a kimeneten, hogy közöljön valamit a felhasználókkal.
Print is a built-in Python function that displays a text or a result in the output screen in order to communicate something to the users.
0:21
Mit is jelent ez valójában? Tegyük fel, hogy van egy Python-kódod, és egy alkalmazást készítesz.
So what this really means? So now let's say that you have a Python code and you are building like an application.
0:27
Ha üzenetet szeretnénk megjeleníteni a kimeneten, használhatjuk a print függvényt. A szintaxisa nagyon egyszerű.
Now in order to show a message in the output, we can use the function print. And the syntax for that is very simple.
0:33
A print függvény nevét használjuk. Ezután zárójelek és idézőjelek közé írunk egy üzenetet. Például azt, hogy „szia”.
We use a function name print. And then we put inside parentheses and double quotes a message. Like for example, let's say hi.
0:40
Ha most lefuttatod, mi történik? A Python végrehajtja a print függvényt.
Now if you go and execute it, what can happen? Python gonna go and execute the function print.
0:45
Fogja az üzenetbe írt szöveget, áthelyezi, és megjeleníti a kimeneten. Ennyi az egész.
Where it's gonna go and take whatever you written inside the message. And move it and display it in the output. And that's it.
0:52
Mindössze annyit teszünk, hogy üzenetet küldünk a kódunkból a kimenetre, hogy közöljünk valamit a felhasználókkal.
all what you are doing is we are sending a message from our code to the output in order to communicate something to the users.
1:03
És persze felmerül a kérdés: mi az a függvény? A függvényekről lesz egy külön, teljes fejezetünk, ahol lépésről lépésre minden részletbe belemerülünk.
And now of course the question is what is function? Now we have like a dedicated complete chapter about the functions where we're gonna deep dive into all details step by step.
1:12
Egyelőre gondolj úgy a függvényre, mint egy apró programozási gépre. Bemenetet adsz neki.
But now think about the function is like a mini machine in programming. You give it an input.
1:17
Elvégez némi munkát, és a háttérben feldolgozza a bemenetet.
It does some work and process your input behind the scenes.
1:20
A végén pedig visszaad egy eredményt, egy kimenetet.
and at the end it gives you back a result an output
1:23
Gondolj rá úgy, mint egy kávéfőzőre: beleteszed a
so think of it it's like a coffee machine you give it the
1:26
kávébabot és a vizet, aztán a gép elvégzi a munkát,
coffee beans and the water then the machine it does the work
1:30
és a kimenetként megkapod a kávédat. Nem kell tudnod,
and at the output you will get your coffee so you don't really care
1:33
hogyan készítette el a kávét a gép, és nem kell ismerned minden részletet.
about all details how the coffee machine did make the coffee it's
1:36
Elég tudnod, mit kell a gépnek adnod, és mit vársz
enough for you to know what you want to give the machine and what you
1:39
kimenetként. Pontosan ilyenek a függvények a Pythonban és más programozási nyelvekben. Felmerülhet benned a kérdés: honnan származnak ezek a függvények? Három fő forrásuk van.
are expecting from the output and this is exactly what are functions in python or in programming languages and now you might ask where these functions come from well we have three main sources for the functions.
1:49
Az első csoport a beépített függvényeké. Ezeket a Python eleve tartalmazza.
The first one is the built-in functions. They are functions that come with Python out of the box.
1:55
Bármikor használhatod őket a kódodban. Ilyen például a print függvény.
You can just use them anytime you want inside your code. For example, we have the print function.
2:00
Ezért mondtam, hogy beépített függvény. Vannak más függvények is, például az input, a len, a max és így tovább.
That's why I said it is built-in function. And we have other functions like the input, the linked function, max, and so on.
2:07
A függvények második forrását a külső fejlesztésű függvények jelentik.
Now the second source of functions, we have the third party functions.
2:11
Külső könyvtárakból származnak, például a pandasból, a NumPyból, a PySparkból, a Plotlyból és így tovább.
They come from external libraries like pandas, numpy, py spark, plotty, and so on.
2:17
Ezeket a könyvtárakat külső fejlesztők, mások készítik, nem a Python részei,
Those libraries are developed from a third party, from someone else, it's not from Python,
2:22
de ettől még telepítheted és használhatod őket a kódodban. Most pedig a függvények harmadik forrása következik: a felhasználó által definiált függvények.
but still you can install them and use them in your code. And now the third source of functions, we have the user-defined functions.
2:29
Ezeket te hozod létre, barátom. Építhetsz például egy mini kávéfőzőt.
These are the ones that you, my friend, create. So you can go and build your mini-coffee machine.
2:34
De most, barátaim, egyelőre csak a beépített függvényekre összpontosítunk, és megismerjük a Python fontos függvényeit, például a print függvényt.
But now, my friends, we are focusing only on the build-in functions for now, and we are learning those important functions that comes from Python, like we are learning now the print function.
2:44
Rendben, vissza a Visual Studióhoz, és gyakoroljuk ezt a függvényt. Kezdjük
okay so now back to visual studio and let's practice this function let's
2:47
valami egyszerűvel: használjuk a print függvény nevét, aztán
start with something basic so we're going to use the function name print and
2:51
nyitó és záró zárójelet írunk, majd közéjük
then we're going to open parentheses and close it and now in between we have to go
2:54
beírjuk az üzenetet, dupla idézőjelek közé, és
and give the message and we're going to do that using double quotes and
2:57
már írhatjuk is az üzenetet, bármit, amit szeretnél, például
now we are ready to put our message and you can write whatever you want so for
3:01
hogy „Szia, Python!”, és kész is.
example hi python and that's it
3:04
Ennyi az egész. Futtassuk le! A kimenetben ugyanaz az üzenet jelenik meg: „Szia, Python!” Ez a print utasítás legegyszerűbb formája.
that's all let's go and execute it now you can see in the output we have as well the same message hi python so this is the most basic form of the print
3:12
Az utasítással csak azt mondjuk a Pythonnak, hogy írja ki ezt
statement we are just telling python print this
3:15
az üzenetet a felhasználónak, változtatás nélkül. És, barátom, még
message to the user as it is and now my friend there are
3:18
sok különleges dolgot tehetünk a printen belül, és
like many special things that we can do inside the print and
3:22
most sorra végigvezetlek rajtuk. Először is:
i'm gonna walk you now through them one by one so the first thing is
3:25
nem kell mindig dupla idézőjelet használnunk, használhatunk
that we don't have to use always double quotes we can go
3:28
szimpla idézőjelet is, és közéjük ismét írhatunk
and use a single quotes and inside them we can go and write again
3:31
bármilyen üzenetet. Ha lefuttatod, ugyanaz történik: a Python kiírja az üzenetet. Tehát használhatsz
any message so if you go and execute it same thing gonna happen python gonna go and print the message so you can use
3:37
szimpla vagy dupla idézőjelet, a Python elfogadja őket, amíg
single or double quotes python gonna accept them as long
3:40
ugyanolyan típusút használsz az elején és a végén. Tehát
you are using the same type at the start and at the end so
3:44
például ha ide azt írom, hogy print, és mondjuk elkezdem
for example if i go and say over here print now let's say i start
3:47
dupla idézőjellel, aztán beírom, hogy „Szia”, majd
with double quotes and then i say hi and then i
3:50
szimpla idézőjellel zárom le, és lefuttatom,
close it with single quotes if i go and execute it
3:53
szintaktikai hibát kapok. Használd azt, amelyik tetszik, de
i will get a syntax error so use the one that you like but
3:56
mindig ugyanolyan típusúval kezdd és zárd. Ez így nem működik, ezért most megjegyzésbe teszem. Barátaim, a printtel
always start and end with the same type so this one is not working i'm gonna go and put it in a comment now my friends you can use the print in
4:03
bármit megjeleníthetsz a kimenetben, és formázhatod, megtervezheted
order to show anything in the output and you can style and design
4:06
a kimenetet, ahogy szeretnéd. Például, ha ide megyek, és azt mondom:
the output as you want so for example if i go over here and say
4:09
írjunk ki például egy csomó mínuszjelet
let's go and print for example like a lot of minuses
4:13
aztán közéjük azt írom, hogy print, és
and then in between i'm gonna go and say print and
4:16
néhány szóköz, „learn python”, és
few spaces learn python and
4:19
utána is néhány szóköz. Olyan, mintha címet készítenék, és
as well few spaces it's like i'm making a title and
4:23
a végére is kerül néhány mínuszjel. Ha most
at the end i will have as well few minuses so now if i
4:26
lefuttatom, ezt a klassz mintát kapom a kimenetben. Olyan, mint egy banner vagy cím, vagy bármi más. A printtel tehát bátran szórakozhatsz, és bármit megtervezhetsz a kimeneti üzenetben.
go and execute it i will get this cool design in the output it's like a banner or a title or whatever so you can and have fun with the print in order to design anything in the output message.
4:36
Találtam egy klassz rajzot a neten, amin egy dinoszauruszt nyomtatnak ki.
I just found this nice sketch in the internet of printing a dinosaur.
4:41
Láthatod, hogy a képzelőerődet használva a printtel rajzolhatsz valamit Pythonban.
So you can see you can use your imagination in order to draw something using print in Python.
4:50
Rendben, most a Python speciális karaktereiről lesz szó. Sok olyan karakter van, amelynek nincs különleges jelentése Pythonban, például a szokásos betűk: A, B, Z, illetve az 5, 9, 0 számok,
Okay, so now we're going to talk about special characters in Python. Now we have a lot of characters that has no special meaning in Python, like regular letters A, B, Z, and numbers 5, 9, 0,

Only the first 5 minutes are free. Install the app or extension to keep watching.

Download
Request another language
Also available as a Chrome extension and mobile appDownload
Translating0%