What is Python 002
It truly is easy, but not strict.
Why you should learn python 001

variables and data types 005
Go into your folder in PyCharm that you made in the previous post. Delete everything from last time. Type in this in your editor
print("there was once a girl named Jane,");
print("she was 27 years old");
print("she liked to be 27 years old and likes her name, Jane");
If you run this, it will write a little story, but if you want to change the name or age, you would have to change it in two spots. You can change the name from one spot and the same with age using variables. There are two steps to make the variable we need: 1 put the name you want for the variable on the top, mine will be character_name, and character_age. 2 put a = sign next to it then place quotation marks, and inside of them type the name of the character_name but do the same for character_age except for the quotation marks. Then change your code to this:
print("there was once a girl named " + character_name + ", " );
print("she was " + character_age + " years old");
print("she liked to be " + character_age + " years old and likes her name " + character_name);
Now you have worked with some variables, let me tell you what. The character_name is a string that is just an understandable line of text. character_age is only numbers like this 123, and amounts can go into decimals like 16.946583 so, this can go to any number. Then there's one more that I did not include in this post yet but is called a boolean, which can hold a true/false value. You might not use booleans very often in the world, but they are super important in code. In the next post, we will talk more about strings.
1st line of python 004
So the first thing you want to do is open up PyCharm and make a new project and add your name then in the interpreter unfold it and put the download from python then click create. Then, on the top left side of the editor right-click on the file that you just made, and click New, then New Python File, then name your file. now you want to open up a new terminal witch we will call console, but if already open then skip this step but don't type in there. First, I will tell you what to write then I will explain. Let's write: print("hello world); then click enter.
Then right next to the play button there's a button directly to the left of it on the top right corner, click on it then choose the name of your project then click play.
What this is doing is telling the computer to type hello world in the console. That's it for now in the next post we will talk about variables and data types.
Then right next to the play button there's a button directly to the left of it on the top right corner, click on it then choose the name of your project then click play.
What this is doing is telling the computer to type hello world in the console. That's it for now in the next post we will talk about variables and data types.
Materials For Python 003
Hello, if you would like to learn how to code in Python, then you will need to download two things. The first thing you would need to download is PyCharm CE from safari. Here is the website address: https://www.jetbrains.com/pycharm/download/. Next, you will have to go to https://www.python.org/download/ and download the newest version available. once you get those two things, then you can start coding in the next post.
Subscribe to:
Posts (Atom)