[Zero-Basic python] Start real programming and basic python Programming
Through the study of the four arithmetic operations, we have initially come into contact with the content in Python. It may be a bit confusing if the reader is a zero-base learner. Do I have to write a few commands in IDE and then see the results? Isn't that a program that can run automatically?
Indeed. Currently, programming is not supported, but some commands (or commands) can be used for simple work. The IDE interface where the official website is located is also used to input commands.
The column is a bit secure. Next we will learn how to compile a real program. The tool is still the IDLE, but please remember that for a real program, it doesn't matter what tool is used, as long as you can write instructions, such as using notepad.
I went to pour a cup of tea and read the following section carefully. The content of the program concept comes from Wikipedia:
- First read a piece of English: computer program and source code. It doesn't matter if you don't understand it. You can jump over and look at the next one.
A computer program, or just a program, is a sequence of instructions, written to perform a specified task with a computer. [1] A computer requires programs to function, typically executing the program's instructions in a central processor. [2] The program has an executable form that the computer can use directly to execute the instructions. the same program in its human-readable source code form, from which executable programs are derived (e.g ., compiled), enables a programmer to study and develop its algorithms. A collection of computer programs and related data is referred to as the software.
Computer source code is typically written by computer programmers. [3] Source code is written in a programming language that usually follows one of two main paradigms: imperative or declarative programming. source code may be converted into an executable file (sometimes called an executable program or a binary) by a compiler and later executed by a central processing unit. alternatively, computer programs may be executed with the aid of an interpreter, or may be embedded directly into hardware.
Computer programs may be ranked along functional lines: system software and application software. Two or more computer programs may run simultaneously on one computer from the perspective of the user, this process being known as multitasking.
A Computer Program refers to a group of instructions that indicate each step of a Computer or other device with information processing capabilities. It is usually written in a programming language, it runs on a certain target architecture. For example, a program is like a braised pork Recipe (Program) written in Chinese (programming language), used to guide people who understand Chinese and cooking techniques (Architecture) make this dish. Generally, computer programs are compiled and linked to become a format that is hard to see and can be interpreted by computers and then run. Programs that can run without compilation are usually called scripts ).
Biluochun is my favorite. Someone will give me a gift. Don't forget it. Do I expect an official reception? Hahaha
Start to talk about programs. In short, a program is a set of commands. However, some programs need to be compiled, and some do not. A program written in python is not required, so it is also called a script program. Special reminder column spaces. Do not think that compilation is good or compilation is not good. Do not think that compilation is "high-end" or that non-compilation is "low-end ". There may be some programmers who have been programming for many years or others who may have such an idea, which is unfounded.
No argument. It's good to use it.
IDLE programming environment
Operation: File-> New window
In this way, a new operation interface is displayed, in which the prompt used to input commands is not displayed: >>>. This interface is a bit like notepad. By the way, it is essentially a notepad. It can only input text and cannot directly paste images in it.
Write two big words: Hello, World
Hello, World. it is a world-oriented sign. Therefore, the first sentence of writing any program must be written because the programmer is world-oriented and never cuts down in a LAN, so the viewer must be able to access the Internet scientifically before they can truly be Hello to the world.
Just put the code in this line.
print "Hello,World"
For example, Style
As mentioned above, a program is a set of commands. Now, there is a command in this program. A command can also be a set.
Note: There is a RUN on the menu. Click this menu and select Run Moudle from the drop-down list.
In the dialog box that appears, you need to save the file. This is simple. Save it to a location. The viewer must remember this location and get a file name. The file name is. py is the extension.
After you complete the configurations, click "OK" and you will find that the Hello and World characters are automatically displayed in another interface with >>>.
Succeeded? Don't be excited when you succeed, because there is no time to celebrate.
In this case, we still implement the automatic execution of the program in the IDLE environment. What if we leave this environment?
Close IDLE and Open shell (if you are using Apple's ms xos operating system or a linux release operating system, for example, I am using ubuntu ), or open cmd (windows OS users, especially those who use windows,It is not your fault to use windows. If it is wrong, you will only use the mouse to point it, instead of using or using commands, or even linux commands, he also dreamed of becoming a good programmer.), Run the command to enter the directory where you saved the file.
It is the address where I saved the file. I named the file 105.pyand saved it in a folder.
In the shell, enter python 105.py.
The meaning of the above sentence is to tell the computer to run a program written in python. The program file name is 105.py.
I am the master of my computer. So it gave me the command. For example:
Still silent? You can cheer. The German team wins the Brazilian team by and is listed as an official player. Fans of both the German team and the Brazilian team can cheer, because you have made a great second step on the programmer's road. By the way, the final World Cup champion should be: Chinese team. (Is there anything else ?)
Solve a question
Please calculate: 19 + 2*4-8/2
The Code is as follows:
# Coding: UTF-8 "Please calculate: 19 + 2*4-8/2" a = 19 + 2*4-8/2 print
Reminder for beginners,Do not copy this code. Instead, you need to enter it with one word. Then save (my saved file name is: 105-1.py ).
In shell or cmd, run python (file name. py)
The execution result is as follows:
In the code above, the first line must not be less. This file can be used to input Chinese characters. Otherwise, Chinese characters can be input as normal.
It seems to be relatively simple.
Don't worry. It's complicated.
Statement
This article belongs to the version after being castrated (the part of castrated is all hyperlinks ). To view the full version, go to the BasicPython in ITArticles of my github (go to github through the topic on the right.
How can I learn Python based on zero programming?
Zero infrastructure is obviously impossible. At least you can type. You can also use English. You should have a degree. Mathematics should at least have a foundation. Logical thinking is also good. There is also a concept for programs.
Therefore, you should have a foundation. A beginner's language should start from the basics. It is best to find the shortest tutorial. But you must be able to understand it.
Understanding this is the most important requirement. There are not many good tutorials. Most of the tutorials are for people with basic knowledge.
You can try to find some tutorials for high school students and children. I used to study C language and read high school student tutorials. I felt quite useful.
It is best to have a basic person, an old professor, and a very thin tutorial for beginners.
If not, follow these steps.
First, learn the expression. Learning variable types and variables. Learned and then learned the statements. The statement is ready for use. Then learn the function. If you have learned more, you can learn the data structure. In this way, you may learn python in 1-2 months.
Even if you are 50 years old, you can learn the python language. However, the highest possible level may be limited.
Is it appropriate to study python without basic knowledge?
Of course you can. In fact, it's similar to reading tutorials online.
If programming really has no foundation, you can certainly start with python, but quick development doesn't matter how fast it feels or how much accumulation you have.