YTread Logo
YTread Logo

Python Tutorial Deutsch: Lerne Python in einer Stunde

Apr 28, 2024
In this

tutorial

you will learn everything you need to know to write your first Python programs in less than 60 minutes. My name is Yunus Energien and my job is to train beginning programmers to become really good software developers. scratch This means that even if you have never written a line of code before in your life, you will be able to follow this

tutorial

here without any problem and I promise that after this tutorial you will be able to write your own. program with Python, but why bother with it? According to the official grid banking, sharing is the second most used programming language in the world and this is mainly because Python has many different areas of application, which means that you can use Python to write. artificial intelligence, you can automate processes, you can write your own web server, or you can process common data with Python.
python tutorial deutsch lerne python in einer stunde
This is exactly why many large companies rely heavily on pipelines, such as Google, Facebook or Spotify. You can work on several small projects with Python, which means you can learn how the programming language works and how to write small programs. This means that if you have this tutorial, you will be able to write your own small programs with Python specifically. In terms, today we will implement three projects. The first is a text generator for applications, that is, if you are now looking for an apartment or, for example, if you are applying for a job, you can use this program to generate a cover letter.
python tutorial deutsch lerne python in einer stunde

More Interesting Facts About,

python tutorial deutsch lerne python in einer stunde...

Completely automatically. The second project is a salary calculator. If you have always wondered, for example, if you earn an hourly wage of 20 euros per year, then you can calculate it with this salary calculator. It is more sophisticated and has a graphical interface where we can display images, the so-called image gallery, which means you can display all the images in a folder and get an overview there. This video is for you if you want to create your first one. programs with me I would like to discover and stop that programming is fun in general. You'll see that even with little programming knowledge you can create really cool software out of nothing and it's all really fun.
python tutorial deutsch lerne python in einer stunde
Let's say we go directly to the computer and start with it. Installation In this tutorial, I will show you how you can install plumbing on your computer. In the first step, we go to Python point org. In the downloads section, you now have the option. Download it wherever you have Windows. Then you need to go to Windows here if you have one. If you have a Mac computer, then by all means go to Mac. The current version of the whistle is version 3.0.1. tutorial at a later date, there may be a higher version here, but that's no problem.
python tutorial deutsch lerne python in einer stunde
It shows that it also works with a newer version of Python, so now you press download, then the download starts and you actually just have to wait until this download completes and then you run the file. A configuration dialog will then open. You should be fine. If you've seen this once or twice, the important thing is that you have both checkboxes enabled in Windows, so it's very important that you do this. buy this app 3.9 and then press the door here, now the screen turns off because you have to accept again that you do everything as administrator and now you just have to wait until the setup is complete.
To the extent that the setup has been completed, you'll see this screen here, it just says again that your setup was successful and you don't actually have to do much, just press close and then of course you'll need a program to edit your settings . Just as you use Photoshop or Paint to edit images, of course you also need a program to edit your co and for that I recommend the program Whip, it is the easiest way to do it on Google and then click download. Here you are. on the web where you can now choose between two different versions: the professional version, which costs a bit of money, and the community edition, which is free and completely sufficient for our purposes.
In the professional edition there are some extra features that are quite nice if you want to program professionally, like support for common frameworks like Django for example, now we just download the community edition and once everything is done we will walk you through it. The setup is disabled as soon as the setup has started, you actually just have to press Next. There are two options you should definitely pay attention to here. The first is that it is best to install this launcher 64-bit and it is very important that you make sure you check the box. It's very important with Windows on Mac, you don't have this option, so you simply press on Mac and then again on Next and wait until all the setup is complete, this may take a few minutes depending on how fast your computer is. relaxed t and as soon as everything is done, there is an option here that says restart, which you definitely had to select and now press next or in Finnish in this case for your computer to restart, so make sure you close all programs. where you may need something else Save the chest and then restart your computer.
This must be done so that it can be accessed correctly. It is linked in the background. Whenever we have restarted our computer, we go to Windows. menu at the bottom left and search. If you have a Mac computer, simply click below. There is a whole application in the bar, you can search for it or press the control and space key combination and tips there. 1 then we can open the program with the Enter key the first time we open the program a message like this is displayed here. It is simply about data protection. Now I'll press compatible here and then continue.
Here we will be asked. If we want to send data anonymously, I will be a lecturer here because I don't want to share any data anonymously. Then the program loads, which may be a small thing. Take a moment as soon as the program loads. this overview and of course we want to create a new project, so I'm going to press this plus sign for a new project here. Now I can create the name of my project. I'll just call the entire test project. I will write the first letter of each one. word in capital letters so you can read everything a little better.
By the way, everything is called a camel case. Here you can now select some settings. Actually, you don't have to do that much anymore. However, one thing is very important: here you select the version of Python that you just downloaded and installed. In my case it was the latest version i.e. Whistle 39 or here Python 39 which is now finally the same. Older version of Python installed by default and from two points something yes, if there is something here with Python 2, then you need to go to these three points again and look for the version that you installed earlier.
Otherwise, nothing else needs to be changed here. The mark should be checked at the bottom here and we press Now just click create. Here are just some tips on how to better deal with the development environment. I always like to leave them open because you can always learn something new. If you don't want to see these tips, press Roger Tips yourself and close it. At first, some files are downloaded here because it is the first project we open and create with our development environment. Once downloaded, installed and configured, we see this overview. Here we can also see the first part of the code.
Just as an example, now we can run these quotas or write our own code. We really want to start from scratch in this tutorial. , so now I'll press control once to select all the written code that already exists here and then I'll press backspace Up to delete everything. The backspace key is at the top right, above the Enter key. Now I can write the first one. line of code in this file and I start writing the so-called hello world program, a program that is always the easiest program in any programming language and with which we can display text on our command line, these black quotes at the same time. , I write between these parentheses with double quotes or with single quotes, it doesn't matter at all, hello world, now I can run this program by pressing run here and then in Rhine-Main you can also see that.
A shortcut is shown here i.e. Shift key and F10. I would learn about shortcuts early on because then you can do codons much faster because you typically run the programs very frequently. Now I click on it and just look at what's there. happening down here, hello world is now displayed on the command line, so exactly this text that we typed here on the command line, I didn't have to confuse it at all, it's just this down here, there's always just a Black Text down here the file that runs in the respective folder, then we are already in the folder c users yunus and so on and then we run a

python

point lizard which is the program with which we want to start this program here but I didn't have to confuse it at all because , as I said, this is simply done automatically by our development environment, so you don't have to do anything important anymore.
The only thing that interests you is that a text appears here. and you have already written your first program. You can write anything you want in these brackets here. For example, I would like to be able to write my name on it, so I can also say hello to Yunus. Now I can save the. everything again and run it again, as we can now see, it says hello Yunus at the bottom. By the way, we can see that there are some underlined lines here because our development environment is always with us. I want to help you. write the best code possible, so now we can just click on this check mark here and see what errors are displayed here.
As soon as I press here, it says, for example, that my name may have a spelling error, that's not it. case with the program Apparently it just doesn't know my name and the second thing is with SAP. At the end of this command we have to add another line. So I just hit enter and this means this error here at the back. It's already gone and this underscore behind the brackets is gone so it recognizes my name correctly. I just go to the other error here and right click on the error message. Now we are shown different solution variants.
I go to quick solutions and here it says I. I could put my name in one change another name or I could add the name Yunus to the dictionary. I will do it once and then the second error will also disappear. Of course, with Tyson we can also create a graphical interface, farmers and programs that. Not only are they displayed on this command line, but everything is a little more complex, so we'll cover it here first and then as soon as you understand it properly, we'll start building a graphical interface. By the way, up here you can not only enter text, but you can also do calculations, for example, if you want to calculate something with prices, now you can, for example, start a second line and not write any. more text here.
You always do it in quotes, but now you can write 1+1 here, for example, if you now complete everything. By the way, you can also do that by clicking this play symbol up. here If you press, you'll see that there are 2 down here because of course it's one plus one. You can also enter various other arithmetic operations here, such as seven times eight, then 56 houses will appear here. The good thing is that you no longer have to write these numbers down. You can also create different variables. So you could say on the first line that I define fixed as eight and just write 7 x iks here.
Everything works the same way. Then you can define a variable iks like math lessons at school. Calculate exactly like this. If I write five here, then we would calculate seven times five and the result should be 35. That worked too. So she already learned the basics of pissing. You know it's a variable. You know how to type text on the so-called command line or command line in English or dates, you can use the terms to display them all as synonyms and you have discovered how you can perform simple arithmetic. operations and can display everything at the bottom of this command line.
Congratulations now that she has learned some basics. Once she has learned Python, it's time to do a little exercise. You already know how to display text here on. the so-called command line and you know whatA variable is our task now will be to write a short CV because you can make it dynamic, that is, now I would like to show here, for example, my name is Yunus and a new line, I am 29 years old, but I no longer want this text here, the 29 or the name, to be displayed statically, but I want this text to be displayed here using a variable, so let's do everything first.
Now I can define different variables. We just said that iks is equal to seven. or iks is equal to 8, but here we not only assign numbers to a variable, but we can also, for example, define a variable called name and write a name here. You can assign different types of data to one. variable Now we have assigned some text to our variable. In itprogramming language, this is simply called string or Python. The abbreviation is a text that you always know about a variable by putting it in quotes, this text can then be used. several job ads, if you want to calculate with the value of a variable, you can do it with a number, for example, yes we can.
For example, define a variable called stage and age and we can assign the number 29 to this variable. with this number and these numbers are not written in quotes so that they are not interpreted as text. In technical jargon, the integer is called an integer in English or in Python the short form is the same way they can be calculated with numbers with eat. comma numbers are not written there comma but everything is done American with a period and that is called floating with comma numbers it can be calculated in the same way at the same time it can also become a variable For example, the shoe value or if it assigns true or false and then you can use this value to check, for example, if this variable has the value shoes and if so, you can do other things in your program besides whether the variable has the value I most valuable.
For example, Here is a variable, I create programs and assign the value to it and then I check somewhere else if I am a programmer and only in this case I display something. All this is called bullish expression. Bullying always means that something is true or false and. Python us Given the short form in front, it is important that if we want to save text in a variable, we always use these quotes, whether you use double quotes or single quotes like I do now, it doesn't matter. Now we can also display this variable down here. By the way, if you want to know why this word years is underlined here, it's because unfortunately the spell checker only works in English.
We can press the check mark at the top right again. then hit the error here and just hit quick fixes here then add the word to the dictionary so this error will no longer be shown okay but back on topic now we want to show the value of the variable up here so I remove the word yunus and now say the final name, what happens now is that this text is still displayed here in quotes, however it is connected to the word that we have written in this variable name. Now I run this complete code and see that it is. still my name.
Yunus is now written here. Now do everything again and here it says Christoph. Let's do the same for our age. So I'll define a new variable, call it age, and write 29 here. Now I have to think a little outside the box about we want to connect two texts with a variable, so I say first we have the first text here on the left and then I say I insert a plus sign to connect the text on the left with our variable if I remove the right part everything looks the same as in the line above we connect a text with a variable now I would like to add another text to the right, that's why I say that now I insert influence here and now another text and that is very important years .
I add a space here because otherwise the space would be between the number 29 and the years are no longer shown. I'm just doing everything. Now it shows an error down here and something. So it is completely normal if you pick it up, it is programmed in the same way as with any other programming language and you will see error messages very often. You won't understand this at first. It is very important that you do not understand it. At this point, despair, but just think again if you have done everything right. Over time you will understand this error message, but at first, of course, I can tell you what this error message is, that is, we want to do it. connect a text with a text with a text, but this is not a text but actually a number.
Theissen doesn't know how to connect a text with a number, so we will say that age is also a text, let's do it. What we have already done in the line above and just writing the 29 between these quotes when I press play everything is displayed correctly so we notice that if we want to connect a text with another text then there can't be just a number in the middle , otherwise it always has to be text. Now we have already achieved a lot and I would like you to try, as a small exercise, to continue this text a little here, which means, first of all, additional variables with additional information. city ​​and you can do this here Write in Hamburg or just your city and now you can make sure that this city is displayed here on a new line, which means now I want you to write here I come and then city, that is, the variable, you can Do the same with 12 more data.
I'd like you to pause this video and try exactly that for yourself. Ok, once you have done everything, I will show you the solution and write. print quotes here again. I come from here, you need to insert a space again and then a plus sign and now we connect the text on the left again with the city variable, the word come is underlined here again, that doesn't have to bother us. Anyway, it's just our spell checker again on the top right, then right click on it and then also quick fixes and add the word to the dictionary so you can write your first program and have a chance to generate a full CV here . our current program can save us a lot of work, we will adapt it a little, for example, I am applying.
I am currently looking for a new apartment and of course I have to write a lot of messages to potential owners. I always have to write. exactly the same text to a landlord or landlady, but of course I always have to change certain information, which means I have to change the name of the person, for example I also have to write to her or the lady or I have to say, for example For example, what fascinates me most about the apartment, which always works well, that is, for an apartment I say, for example, what fascinates me most about the apartment is the beautiful living room in the other apartment, I say: On the other hand, in the case of the apartment, what fascinates me the most is the beautiful balcony, so I simply have to replace the word living room with balcony, so that it always adapts to the apartment in question and the district in which it is located.
I'm applying. Yes, I will apply in that quarter sometimes in the other and I always want to include the name of the quarter in my cover letters, so this is already a program with which you can generate texts that really help. in life to automate a task and that after just ten minutes of Python, you could now formulate a beautiful cover letter here in which you say print dear sir more name my name is my name so of course you had to define many more variables, maybe not I don't want to, dear sir, but also dear madam.
Yes, that means you have to put in more variables, but with that you can generate an incredible amount of text without always having to rewrite it from scratch. I would say we should do this. like the following exercise with some data. So here I say it now. First of all, Meyer, because I want to write to a certain Mr. Meier and my name is still underlined. In the next step I would like to show you something interesting. so now we can solve this problem, which has to be written here: "Mr. Dear" and "Mrs. Dear Madam". Can we just write to another variable and say here, underline worms equals crew? text or a number in a variable, but you can also write the value in or if or in other words true or false of one of the elementary things.
When programming, the program behaves differently depending on the value of the variables. This means yes. this variable has the most valuable value, for example, this sentence should still be displayed here. However, if each value is true, then another sentence should be displayed here and everything is done with the so-called rock branch. or in German if it then branches that means I say now is underscore woman colon do one thing so here I say for example print dear woman + name and otherwise only if that one no is the case. So this line will be displayed here, which means that this sentence will be displayed here or this sentence depending on whether the variable is listen to you or whether, now we will carry out everything once by pressing play here.
Now it says Dear Mrs. Meyer because here now the value is where. has the value true if I only write here for women if and then press play again and then it says here, dear Mr. Meyer, so this variable is extremely useful to generate a different sentence and then Do you already have the opportunity to write a very dynamic program Do you already know what variables are and you know that you can write both text and numbers, as well as Bohlens, in a variable, so true or false, Julien, that sounds complicated again? Bullish value is ultimately a value that is. always 1 or 0, that is, true or false, or in today's programming languages, computer or if that is, by the way, also, among other things, what these 1 and 0 mean, which are heard a and again in connection with computer science and programming Now finally it is all a question of whether a value is true or false, that is, if you can really equate it with 0 and if you can equate it with 1, now that we have done everything, you can actually generate a text complete from here, that is, up here.
Maybe my last name should still be there now and of course I want a comma to show after Dear Sir or Madam, of course I'll add everything here and I'll do it all here right now. My name is Yunus. Now, stand here and behind here, of course, another text must be inserted again, that is, 1 point. Here we also need a point and here, of course, we have. I also need a point behind the city. If I press play here, I already have a complete text generated. If I want to generate another empty line, I could of course also add another print statement here so that a text from the teacher can be easily added.
Press play again and now everything looks like this. By the way, some errors are shown here, yes, I accidentally made one here, I added a semicolon which shouldn't be the case, that's what you do with other programming languages, yo. I think you'll see that more often and these are all so-called spelling errors which of course are a bit annoying because our idea just doesn't know the German language by default, but that, for now, doesn't do anything. In software development there are three fundamental concepts that you can find in almost all programming languages, these are variables that you already know, then the so-called branches, that is, with this you find elz and the loose calls o. loops in German In order to repeat code more often, you will learn about the other two concepts in this tutorial. 1 You can do it now.
The important thing is that you not only hear these concepts once but also learn to apply them. This is exactly why we are now doing an exercise on the topic of variables. We will continue with the following concepts after we have generated everything, I would like to give you the task of completely generating your own text. No longer just creating a text like I did here, but trying to create my own text a bit Generate Maybe you have a text at work or in your private life that you write over and over again, but you had to use certain variables in this text or you have certain cases, if that is the case then just try this program to suit your purposes and when you have achieved that then you have yours.
The first pricing program written is quite good and can definitely make your life much easier with the. However, in many cases there is still one thing that most users are probably missing, people who will be yours later. The program is totally annoying. Now you always have to fill in these variables here in the program yourself. It would be much better if you could write what you would like to have in this variable and you can do that very easily in Python. just typing the input here write and now write something here as a string for example enter the name with a colon if I run this program now and press play here then it will just open this line here and here it says enter the name if Now here, for example, Müller Rhein I write and then I go to enter and then a cover letter for Mr.
Müller is automatically generated. Now you can do everything for some of these variables here, so my name, age, and city remain the same for now. So I don't want to change that, but we have one. If you want to write to Mr. Müller, that, of course, always changes and for this reason you can now simply enter it here and that, of course, is quite practical. Of course, now you can just open the file that you created if I click here on the right and then say open in Now I can also open Windows, for example in my explorer or on Mac in my enemies.
I press it here and. Now the folder opens that contains all the files that our development environment has created and this motherboard is our finished program. Now you can open this program outside of our development environment. I can just double click on it here and our program will open. in a separate window, which means you can now use this program without a development environment. You can charge it. You can let other friends download it, for example, andYou can publish this program if you wish. People who use this program must have Python installed on their computer, otherwise everything will not work.
If you enter your name here and then press Enter, you will experience a little disappointment and that's close. I just run the program again directly and that's it. for a very special reason. Now I'm going to open this program with, for example, the text editor. Then we will see the code very quickly and we will be able to edit it very quickly without having to open the whip again and see it. Here now we want all the numbers to be executed one after another and what happens when the program reaches the last line it just closes again which means we have to somehow make sure that the program doesn't close and that's why that you see at the end of many programs the command line runs and here's just another entry and here it just says please press any key dot dot dot yes, you'll see that very, very often after we've already written the correct program. , I would say that we should schedule another one and I found it quite interesting to calculate how much money you can earn later with a certain hourly wage, that is, if I now earn nine euros per hour, for example, how much will I earn? in a day, how much will I earn per week, what was not that, of course, it would be very interesting and something like that, of course, can be calculated perfectly with Python and that is exactly what we are doing now and I would recommend it if you already have a idea of ​​what's going to happen, then it's best to try to schedule things yourself.
This means you stop the video for a moment and simply write down what you expect to happen next. This means that the learning effect will be. much older. So the first thing we obviously need is a variable that says what we earn per hour, ie. Now we create a variable and we simply call it hourly wage, which is then defined as a variable, mainly in English, but now. I will do everything briefly in German. For example, what I am writing here is that I currently earn nine euros per hour, which means I can only say that your hourly wage is 9 euros, so I will only write hours. here and then maybe the word euro after, so I'll write a little text here again euros and a space.
All this won't work for now because we are here. Insert a number and no longer a text as before. If you saved everything here as text in the variable and ran everything, our script would work. The problem is that it can't be calculated with text because Python doesn't know it's a number, so. We just have to convert our number into a text for this step and to do this we have to write trier again in front of this variable, open the square brackets and close the square brackets and now we will write our variables in these square brackets when we do this. everything now.
Let's see that everything works again, so the idea is that we convert our number here back into text in case we need it as text. You can imagine a variable like a box and you can put different things in it. the box, for example cookies or chocolate or cheese, some things and at the end you always have to say what these things are used for. When programming it is exactly the same. You have a box called hourly wage and you can put a text. In this box, put a number in it or a variable called bullish to carry the value or if what we already had in the last tutorial now that we know what we earn per hour, of course we also know what we earn in a day. , that means that now I can simply say that we work eight hours a day, so I write, put an eight here and take it all times our hourly wage, which means that eight is now multiplied by the number 9 in our case. say what the respective person earns per day, which means here now you could say that you earn something per day here between now we have to write the result again and of course we have to convert it back to a so-called string, so that we write everything here now if I press play it says here you earn nine euros per hour and here you earn 72 euros per day.
Maybe I'll add the euro symbol again to make everything look a little better. I think you should have done it. I already understood the basics. A month has 30 or 31 or sometimes 28 days. Now I would only say 20 business days per month. Calculate, which means that your task will now be to calculate what a person earns per month, so you create a new one. variable and of course you should output this value in a sentence below. I'd like you to pause this video for a moment and try that. If you manage to do everything, continue playing this video and see if you did everything. thing the way I do it.
I follow. I'm curious to see if I've been able to resolve the issue. I'd say let's do the math together now. How much do you earn per month? I create a variable called month. and now calculate what we earn per day multiplied by 20. Then I go down and add a new printed statement and say that you earn per month plus month plus euros. So connect the text on the left with the text on the right again and this won't work again. We still have to convert our month into a string and we do everything like this, but we press play and here now it says what we earn per month for the year, of course, twelve months as we know, so you have to calculate the total. again, which means we only have to calculate the month multiplied by twelve, so now we can tell what kind of annual salary you have by simply saying that you have an annual salary of plus a string of euros, look at everything again, press play again and here it says that you have an annual salary of 17,000 280 euros and the good thing is that of course we no longer want those nine to be fixed, but we want to energize those nine, which means that now, for example, we want to enter. ten or eleven or twelve automatically and of course we could do everything like this by writing a 12 1 here and now press play, but we no longer want to have to enter everything up here, but this one.
The program can also be run by others who may not see the source code. This is exactly why we do what we did in the last tutorial and we simply type the input here and here we can now specify some text that is specified on the command line. For example, give two points to the hourly wage if I do everything and write my number 1 here. However, something will happen that could not have been predicted, that is, results now appear that do not make any sense. The same error that we already had, that is, that a variable always has to contain a number or text.
Now it's so we can enter some text here when I run the program. So I can't just enter a number here, but. of course, everything I could here too. Actually entering the word hello doesn't make any sense, but it would be possible and the program doesn't crash in this case, but we can see exactly what happens if I say the day is hello eight times. then the word hello is printed eight times, everything. Of course we don't have that, of course we want to say that what we enter here is a number. That's exactly why we have to somehow turn this entry here into a. number and that's exactly what we're going to do now by simply packaging the word here in Rome and again doing these square brackets here over us just like we did everything, so down here we convert a number into a string and up here we do exactly the opposite, we were in a string in a number and what does that mean number in english integer when we talk about an integer we convert a text into an integer so we can calculate with it if we do that and restart our program then I can enter a 10 1 here and this ten will now be a number interpreted on this line here, so we take eight times the number 10, what comes out is exactly 80, that's why all our calculation works here, a number is now saved automatically.
That means that here we no longer have to insert an integer in front of it and have something after these colons. I always like to add a space that I have to add here. Of course, you could continue developing this program forever. You could include a lot more calculations, for example, you could still use vacation days or something, or maybe you work more than 20 days a week. All of this is possible and what is particularly interesting is exactly how you build the lots. from different computers. Yes, it is no longer the case that you can only build a computer, but if for example now you want to have the calculator that calculates the sales tax of a product, yes or in general how much tax you have to pay. pay per year, then it works exactly the same way with a computer like this, you can start doing a lot of incredibly interesting things.
Now you have the opportunity to write programs that can really make your daily life easier. They don't have a graphical interface and aren't very complex yet, but you definitely have a good grasp of some of the basic programming concepts. By the way, you can also create Python files without having a development environment installed. to your desktop now, you can easily do it here Right click on new and create a new text file. It is important that you say in your settings that you want to show the end here. Now I can just say here that this is my. xt computer, open this file and then add the code I have written here.
I close the file again and now I change the dot txt on the back to dot on now it says here if I really want to change that and I say yes and We'll see what happens so we can just open this program here with a double click and it works if now I say I earn 22 euros per hour. Everything is calculated here, but in the end the program is displayed again, which, of course, is a bit annoying. , and is only displayed for one millisecond. We could avoid this, for example, by opening the program again with our text editor and at the end, for example, asking for input again and simply not writing anything there. of course, even cleaner options, but now this is the easiest thing to implement with the buffet in which you know, I've saved everything, put it in expressions 22 again and we'll see here that everything works just like this trick when entering. and the program closes and I'm sure you've already seen this with one or another program that opens on the command line.
Now you can write here, for example, press any key to close the program, close a program. It always closes when there is nothing left to do, that is, the last line of the program has been fulfilled if I double click here and put 35 1 here, for example, there is already a very good hourly wage of 67,000 and here in the end there is a pressure. Any key, I made a mistake, never mind closing the program. I press Enter again and the program closes and now you can write your own programs and thus become fully realized. Have fun with the basic concept of this section that you should know in programming, that is, the so-called loops.
Imagine that you want to display the numbers 1 to 5 on your command line and of course now you can type print and here a 1 and then. you could say print 2 print 3 and so on, by the way, the lines are duplicated here by just pressing control when I'm on the respective line, so after we've inserted this here, I'll tell you, but maybe ok, flights, for Please, the numbers from one to 100. 1. Could you copy the line here a hundred times if I ask like this? Of course, the answer has to be no. There are methods that are much smarter and one of these methods is. the so-called previous loop, so we delete everything here again and start again with before and now we write I have these strange brackets here and a colon in these brackets.
Now I can write, for example, 1.23 and so on. so all the numbers that I want and if now I press enter we can see that we are automatically indented here and if so now I print here I write then iks is a variable that we already know and this variable now goes through here three times, which means that the line 2 in our code now it is executed three times and the first time it has the value 1, the second time it has the value 2 and the third time it has the value 3 try me all the time by pressing rhine-main here now we see that the numbers 123 are displayed down there on the command line and of course now we can just use any number here Enter the numbers 45 and so on, always separated by a comma or we could also enter other values ​​here like like apple, a fruit with a B is maybe a banana and a fruit with C is clementine and now comes something that is very useful for us to automate in Python.
If we now want to represent the numbers from one to 100, we don't have to write the numbers from one to 100 here. Here are concepts that will help us simplify everything again. We can also remove all this construction here and use it here, for example, range to write in square brackets and here. I can only write 1.1 100 for example if I now run all memory and here at the top right we see that the number from 1 to 99 is now displayed we say that we want to stop at 100 divided interpreted from the fact that there was already a number here before last time we ran this code here, which is why we go from 1 to 99.
If I wanted to see up to 100, I would have to type 100 and 1 here and now run thecode again, a particularly Something interesting thing you can do. For example, if we look back at the first build, we said we want to display three elements on our command line, one, two, and three. Now we can not only display individual pairs here, but we can also display them. We can, for example, here also insert a cooking recipe in which we say, for example, we need two eggs, we need 200 grams of flour and we need 200 milliliters of milk. If I run everything again now, a bake.
The recipe will be shown below, of course, everything is exactly the same principle as we just made. However, now you can combine this from the examples in the last few tutorials and define a variable to say how many slices I want to convert. For example, I can define a variable called Porsches here again and say here I want to convert four slices, for example, now I can make this variable dynamic here. For example, now I can write here that we want to convert a number to a. string and I want to connect it with the word yes here now I write porsche 0.5 by doing this the number now becomes four which we save above in the variable porsches multiplied by the number 0.5 everything now becomes a text and this text is combined with the word eggs when I run everything, of course it will be 2.0 down here if I do that part now in three from the end and run again it says 1.5 eggs at the bottom if I go here in two agendas it says one egg at the bottom of course, We can also do everything with flour, milk and other ingredients and thus we have a dynamic cooking recipe.
I can always adapt it to the respective portions. With this knowledge you can now create different cooking recipes. and you could even make an entry where you say which recipe you want to load and thus consult the respective cooking recipe with a query 11 and 11 Have fun implementing everything. It's all a beginner tutorial, but I still have a little homework. for you and that is I would like you to write a little program here yourself where you can select different recipes, which means here it just says select recipe on the command line, cakes, waffles, cheesecakes, etc., now you have to press the button once to show the pancake recipe twice to continue showing the recipe and 3 times to show the cheesecake recipe now we have to define a variant which I call selection and this variable now had to be assigned on the command line a tip like We Already learned how to do everything, which means that now you type the number 1 2 or 3 1 and then the number is assigned to the variable selection.
Now you will see if the variable selection has the value 1 and if so then. you point it out Command line shows the pancake recipe if now, for example, there is a 2 1 then you show the coat of arms recipe and with three samples the cheesecake recipe have fun implementing it in the next section we want to create a website small with

python

it is important that the websites are always with you html and css are rooted and not with whistles, you can't do that and that is exactly why split is used to generate this atm l code, you don't have to be an expert in html to follow this tutorial, I explain all the html commands that I use, but now it is about the topic of HTML because otherwise you will not be able to create a website.
In this section I would like to build a small photo gallery with you. Of course, with Python you can also generate files, including of course HTML files and I'd like to do it all with you now that I've created a new project just by going to case here and then new project and. calling the entire gallery we remove all this code and now we know how we can generate text with this printed statement and here. Of course, we can't just generate cheap individual numbers, but we can also generate code that has it multiple times now. it saves everything in a variable and just calls it html if I assign multiple lines of text to this variable in hours I only have to make three quotes in a row like I did now if I press enter and on top of that I have quotes and three quotes at the bottom.
I can write anything here if you already know a little bit about HTML code, you know that. If you write an HTML page similar to what I'm writing here, what you see here is pretty much the same. basic structure of each website, which means simply creating a file ending in dot html and putting said code in it. Then a white page will be displayed if you add a header with tag h1 here for example and type something here, for example my b in the gallery, then this text will be displayed here like this. I'll show everything in the console first.
I just print my html code here, press play again and see this text showing up. like this in the console, but now we want to create a file where exactly this html text is here, so we use this code that I have now. I inserted it here once, you don't need to understand it exactly in terms of syntax, but it means something like we create a file called index.html, we write to it, it's a file that we create and we write to what we have up here. In our variable that we just defined, we run everything. once and see what happens.
As we can now see, a new file has been created here and now we can open this file with our web browser. So I right click on this file and say open here and I go here to the browser and. nor in my case now Chrome, but you can choose what you want here, now we see our first html file created. If you know anything about html, you know that you only see what's in the area and also what's between all these angle brackets. these just for control to say how something should be displayed, for example that this text should be displayed here as header if now I insert another text here, all the memory again.
Press run to generate a new file and now look at everything in our web browser and now we refresh, we see that this text is displayed much smaller because it is not among these h1 like the other text in Pixar B. com, you can download images for free, I I would like to use them in my image gallery. exactly why I selected some interesting images and downloaded them. It's also relatively easy. You can just click on them to download them for free and then press download. From time to time, you should mark some things here. If you download a few more images one after another, then I create another folder here in my gallery folder called img for the images where I now have mine.
I am copying all images at point zero jpg 1 jpg and so on. I can work better with him later. I already downloaded four bathrooms in this folder. I could add more later, but we definitely can do it. You can always add images to your page by simply inserting the so-called image tag instead of all of them. this. I just say source img and now I go to our image i.e. images folder and there the zero point jpg file so that I can now embed this image here from the images folder with the name null point jpg on my website.
Run the program once and then open the page we generated again in the web browser and refresh everything. As we can see, this image is now integrated. However, I am not including just one image but several. at the same time, I want these images to be even smaller. Step by step, we will make everything smaller and for that we have to understand a little CSS. CSS is a language that you inevitably always learn along with HTML. that you can tell what certain elements look like in this case. Now I would simply like to say that each image has a certain width and a certain height.
Yes, that means that here I say between these strange style tags with the CSS language that my image, for example. For example, you have a width that should be 200 pixels and a height that should be 150 pixels. Yes, I prefer to increase the width here again to 400 pixels. I also want my image not to be distorted. front page. No problem if you do all that here. If you don't 100% understand what I'm doing now, if you want to understand it 100%, I recommend that you read a little bit of HTML and CSS. , that is always the basis for every website.
I run everything once and refresh it and this is what mine looks like now integrated from this, so what have we done? We say that an image is embedded on our site and the image has these properties. it has a width and a height and it shouldn't be distorted, that's what this strange command here with this syntax here means. To get a little familiar, you obviously need to have programmed and built a few websites yourself before you understand this 100 percent. Practice makes perfect and I recommend that anyone starting with something like this create five to ten small websites before even starting to use Python.
Okay, now we want to make all the fun even more dynamic. We are no longer happy with a single image. it is always displayed here i.e. zero point jpg, but now we finally want all the images in our folder to be displayed here. Yes, that means that this line here, it should be here several times, ordered once, two are stopped and three. are standing, if we build everything this way, it will probably work. Yes, we press play once, go back and refresh our page. We can see that all the images that we want to have now are there, but we.
I want to finallyNot that we have to write our code here with HTML, then we wouldn't need any pricing, but we want everything to be automated. If bathrooms 0 to 3 are here, images 0 to 3 are inserted here if you only have two images in the folder Then only the first two and that means that this part that I have now marked, we have to make it dynamic and that is exactly what we are dealing with now. You can limit this variable here, the text in. this variable, so that it is only generated up to here, yes. That means I'll end everything here, we'll ignore everything below these three quotes and up here only the top part of our HTML page will be displayed if I want and the bottom part is also added to this variable.
I can do that with a plus equals to plus equals. I can simply add more content to our variable that has this content, so in this case what we see here between now if I do that. run everything it looks the same as before but now I am taking these images here and these images need to be used dynamically in other words now we need some magic that takes the images out of this folder here and adds them to a variable and then automates this here repeated four times but with the correct images in each case and that is exactly what we are going to do.
Now do it and here you will see one of the great advantages of Python. Python is very common around the world, which means you can Google almost anything and you will immediately find a solution from authors like Stack Overflow dot com. All you really need to know is what exactly you should Google. In this case, I just googled pole python files always in English. very important balls and we just press it and scroll down and see right here what our solution is. It says here that this is exactly the shortest way. That's why I'm going to copy this now with Ctrl c, return and our code and. paste everything here and here now it is said that we defined a variable called hold ames where all our files are stored, all you have to do is replace my path with the name of our folder, our folder is called img so I simply wrote img here as text with these quotes.
We can test if everything works by simply using print to print the value of our variable when I do everything. Now running here we can already see what is happening here, of course. , is our generated html code, like before, but at the top we now see this value here that's in our variable, meaning all the images in this folder, which are now enclosed in these weird square brackets. Inside, everything is called a simple ray and is ultimately a container with several drawers, which means that in our variable there is not just one value, but several values ​​in a row.
You can always store several values ​​in a row in a variable. in a re call, you can say that you want to have the 0 in the first, second or third place or you can simply say that you want to run a certain section of code over and over again for the content of this and that's exactly what we want to do here now between you. For example, now I would like to tell you that you want to run a certain code for each arrow with name f in finance. You would like to add more HTML code. your HTML, specifically this one, now I'm going to remove everything and add this code here as a string, so with these quotes here we only take the single ones because we already use the duplicates inside our html code down here, check the complaints now.
Because we have too many free lines, I'll take one here and run everything. Now we can see in our code that multiple images were inserted one after another, so everything worked pretty well. Now we look at everything, when we refresh the page, we can see that the same image now has four times the reason why the same image was inserted because we simply said that we want to insert a static image here, that is, the image ofzero point jpg. now we have to replace this zero point jpg with zero point jpg 1 point jpg 2 and so on and we can do everything just fine.
Just do it with this f4, this f represents the respective file name which is stored in our part name variable in our finance variable zero dot jpg 1, 2 and 3 dot jpg are stored and now we have to insert everything here somehow, but now we can't just copy it because of course Tyson isn't clear that this is a variable. and not the name, however, what we can do is that with this plus what we did in the last exercise, we simply add the f Insert and then everything should work, that is, now we connect this text to the left. side with the text on the right side and in the middle we add a variable 1.
Now we can test everything by rerunning everything and we can see that here it says point zero jpg 1 point jpg two points jpg and three points jpg and our 0, the image now it's a lake, for example, that means if I rename this file now, for example, lake jpg and then run our code again, we'll see this here now. At zero, there is nothing. It is no longer inserted, but here it simply says lake jpg. Everything is sorted alphabetically, so the image in our folder and here in the folder just jumped to the bottom. You can see here are four different images in our image gallery and that's actually all we have to do with Python to display our website correctly if we now want to do things like press it and everything zooms in and displays. big or we can do something here, move the mouse over it, we need space between the images etc.
You can't do everything with Python. It is not possible to do this with Python when creating a website. you need HTML and CSS code, nothing more and that is exactly why Python is used alone, it never helps to create a website, an application or a game, you will still need an auxiliary language like HTML and CSS with which you finally say what is displayed and how. everything should be seen and that's exactly why I wouldn't use Python. I recommend your first programming language, even if you can use it to automate easy things at first, but to find a job you must know exactly what you have. to generate with Python.
This is exactly the perfect language for people who are, for example, mathematicians and mathematical evaluations. If you want to have or are a statistician and want to evaluate numbers, before we get to the end there are two more things that are important. First of all, what you have just seen is of course just a small excerpt of what is possible with programming, but now you should do it. Have you ever understood if programming is fun and if all this is for you? Logically and proceeding in a structured way. If you now want to learn how to program, check out this channel.
Here you will find everything about side entry, about the programmer and how exactly you have to do it and what you need to learn. If you're already a little bit more advanced and you're like okay, programming is a lot of fun for me and I'd like to do everything as a job, then just click the link at the top of the video description because my job is. Not mainly to create YouTube tutorials, but I train people to continue programming. If everything is really interesting, you can simply arrange a no-obligation consultation with us, where we can find out if everything is interesting for you. or not otherwise I would say see you again in the next video take care of your Yunus

If you have any copyright issue, please Contact