Start with learning Python and learn Python programming.

Source: Internet
Author: User

Start with learning Python and learn 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. So far, 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.

Computer Program

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 the column to be sent to the viewer? 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 remind windows users that using windows is not your fault. If it is wrong, you will only use the mouse to point it, instead of using or using commands, or using linux commands, you also dream of becoming a good programmer .), Run the command to go to 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

Remind beginners not to copy this code, but to input it in 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.


Learn programming well

[Language selection]
Remember: programming languages are just a tool for programmers to "speak.

Although C language is a required course in most universities, 90% of students cannot write software, and many of them have passed the national secondary level.
It is undeniable that C language is a very suitable language for getting started with programming. But it is used to write general applications. The Code progress is too slow and the Organization is too difficult (compared with Java and C #). Unless it involves the underlying operating system (embedded development, image processing, compiler), the general company will not consider C.

General application software development

1) C ++: MFC is a little outdated. It uses c ++ to encapsulate some win32 libraries.

2) Java is a real cross-platform language (windows, linux, mac, and even mobile phone platform) and an object-oriented language. Many large internal software of foreign companies are written in Java.

3) C # syntax is similar to Java. It has the fastest development cycle and is suitable for personal rapid development. Although the cross-platform capability is not comparable to that of Java, it is a good news that Microsoft supports and VS.net supports development platforms in multiple languages.

4) VB is a good tool for programming amateurs, but it is not suitable for writing large software.

Another scripting language, such as Perl and Python, is used for web development.

After learning C and the data structure, you only need to choose the same depth as above.

If you want to write good software, you must have a deep foundation. Algorithm is the soul of programming, middle school can participate in NOI, the University can participate in ACM-ICPC, exercise yourself (take the award is better, don't worry about the way out ).
For those who want to learn software, the data structure and software engineering courses should be nice to listen to. It is best to understand the operating system principles and databases.

To find a job, you need to select a direction: application development, network programming, image processing, databases, games ......
Reference: Experience: Just as proficient is enough, proficient in all impossible


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.