程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

It is difficult to learn Python by yourself. What is the way to get started? Dry goods delivery

編輯:Python

The first thing I want to say is this , For those who want to learn programming well , No matter which language you start with , Language itself is not what we should care about most , At least not the first thing I care about as a beginner .

It can also be said that what makes you feel difficult at first is not necessarily the language itself ( Such as grammar syntax etc. ), But the whole The idea and structure of programming . In fact, what you have learned python The grammatical and operational aspects of language , Compared with c/c++ and java Wait for the language , It is a relatively simple introduction for beginners of programming .

01

Understand what programming is

Before learning programming , You have to Understand what programming is , Why do we need to program ?

Only when we know what we want to learn, can we know what to do to learn it well . As for my own understanding , In a narrow sense, programming is actually writing different code for different languages ( What is programming ?), The purpose of programming is to communicate with computer through programming language and manipulate it to work for us , Achieve what we need ( Algorithm algorithm etc. )( Why do we need to program ?).

However, we choose the programming language according to what we need to implement , For example, for Android , Namely java,xml etc. , about ios Come on , Namely object c And so on. . So as I described earlier , Programming language is for us to communicate with computers , Just like we learn the language of a country in the world to communicate with people in a country , Instead of learning a language for the sake of learning a language , Language is not our ultimate goal in learning programming , Just the beginning !

02

How to learn programming well

After knowing why we need to program , Let's discuss how to learn it well .

In fact, the introduction to programming , Should be a learning programming ideas , A deep understanding of what programming is a process .

As for what language to choose, it is not so important at first , You can even use pseudo code to learn , But for the convenience of beginners , The language that can be realized in practice can make beginners understand programming better .

That is why most schools ( At least most Americans computer science( Computer science ) Undergraduate ) My first class is called intro to computer science with XXX language( use XXX Introduction to computer science with language implementation ).

Another tireless statement , there with It also explains the following xxx Language is a tool to help us learn computer science , Getting started with computer science is our focus , Instead of calling XXX language lesson .

I have to complain about it here , Some domestic computer training institutions advocate that so and so language is strong in order to quickly train programmers , And only focus on training students to learn programming language . In this way, we can only cultivate program callers who imitate others , Instead of the computer science workers they had hoped for .

03

Introduction to programming dry goods

Okay , Said so many big things , Here are some dry goods , Let you get started with computer science faster .

The first lesson of introduction to computer science is why we should learn programming except what I said before , What is programming beyond some theoretical words , The first practical thing is that all programmers know Hello World( At least for the most part ).

stay python The middle is :

"print "Hello, World!"

stay java Namely :

public class ClassName {
public static void main(String [] args) {
System.out.print("Hello, World!");
}
}

stay c++ Namely : 

#include<iostream>
int main{
std::cout << "Hello, World!";
return 0;
}

These three actually mean the same thing , Is output through the system string( A string of strings )

When there is an output, there is an input , such as input() (python), cin(c++) etc. . Input and output are available in almost every programming language , It is also one of the most basic means for people to communicate with computers .

Then it usually starts Introduce data types (data type), such as int,double,long,boolean etc. ( stay python Relatively simple in , Because you're defining variables (variable) The system can automatically identify the data type of the initialization value or assignment value of the variable ).

It should be emphasized here that although the data type looks simple , But we know that whether people communicate with each other or with computers , The exchange of information is the most basic purpose , In computer science, the exchange of information is based on the exchange of data , So data is very important for computer science . And with the future study , Gradually master and skillfully use various data types , Specify when to use what data types, etc . You will even learn about abstract data types in the future (abstract data type).

The next step is to learn something Judgment statement (if/else sentence ,switch Statement etc. ) And loop statements (while loop , for loop , do while Cycle, etc ), This involves a very important data type (boolean Boolean value ), Simply right and wrong (true and false). although boolean The basic concept of is well understood , however boolean Is the basis of Boolean algebra .

Basic Boolean algebra is involved in discrete mathematics , So here's an emphasis , For computer science students or those who want to learn computer well , Mathematics is very important , Especially discrete mathematics .

Unlike many universities' indifferent attitude towards mathematics , On the contrary, they should pay attention to the cultivation of mathematical ideas in computer learning . Discrete mathematics is the foundation of computer science , Calculus and linear algebra are the basis of discrete mathematics , Therefore, the mathematics courses arranged in universities should not be ignored by students and teachers . In the future, whether in the study of data structure or algorithm , The foundation of mathematics can help you learn computer science well .

And then there was Learn functions (function) The concept of . Function is essentially a method that abstracts the process of communication and operation between us and computers to facilitate our repeated use , So function is also called method in programming (method). It can make us do the same type of operation , There can be a similar solution to , Instead of repeatedly entering a lot of similar content every time .

In computer science , It's a good habit to simplify , And functions are a foundation that helps us simplify our programs . Functions are usually defined by the return type or the data type of the function ( What we want to get from the function ), Parameters ( We give the function what it needs ), And the body of the function ( How functions work ).

Function also just reflects a way for people to communicate with computers , People give function parameters , The function gives us the return value ( Or sometimes the function is void type , That is, no value is returned , however void Usually, it will complete the specific operations we need ), It also happens to be a method of information exchange .

04

About object-oriented programming

I'm learning c++ The pointer is also involved in (pointer) The concept , This is c++ A very important concept in , Also need to pay attention to things in the future , When you learn it by yourself, you will understand .

After learning what I mentioned before ( Although I haven't covered it all in detail ) Compare the basic concepts of computer programming , You will be involved OOP(object-oriented programming Object oriented programming ). In high-level programming languages, it involves a lot, even the foundation , It is also the programming trend in the future .

In fact, if you only use what you said before to program , It can be narrowly defined as process oriented programming . actually OOP Is after the function , Another way to simplify our programming , We make things more abstract but more convenient . By defining our own data types , Create objects (object) To realize the management and operation of data .

Communicate deeply and purposefully with computers through objects . Three cores of object-oriented programming ( Important but not limited to ): encapsulation (encapsulation), Inherit (inheritance), polymorphic (polymorphism) . Encapsulation is to assemble the data types we define into a whole , So as to form an available object ( A bit like a mold on a factory assembly line ), Inheritance is to get some features of a parent class or some parent class and use them in new subclasses ( Just like some characteristics that children inherit from their parents ), Polymorphism is the implementation of some abstract methods that can be applied or redefined ( In short, it is a variety of states that a thing can present on different objects ).

Object oriented programming not only simplifies and facilitates our programming , At the same time, it protects the privacy of data in the process of exchange . similar private Of , Only your own objects can know and own ( Just like your wallet can only be controlled by yourself ), similar public Of , It can be shown in main function ( The main function ) For other data . This clearly defines the use of data , It is also an epoch-making progress in the history of programming .

Said so much , Just a simple description of the introduction of the computer , In the future, I will learn about data structure ( How to manage our data ), And algorithms . I hope it helped you .

As for skills , I think the most important thing is the way you learn programming , That is what I have repeatedly stressed , Not just focus on the programming language itself , But with in-depth study , Constantly master and understand the main ideas of programming .

Last , Thank you very much for reading my article ! If you have any questions, you can send me a private message backstage , I am happy to answer .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved