学习python多少钱_python学习什么以及多少

学习python多少钱

Python programming is like endless possibilities. Web and Internet Development, Desktop GUI based application, Machine Learning, Deep Learning, Software Development, Business Applications development there is a big list of use cases of Python programming. Considering so much is there to learn, it’s easy to get lost and wonder how-much-is-too-much.

Python编程就像无穷无尽的可能性。 Web和Internet开发,基于桌面GUI的应用程序,机器学习,深度学习,软件开发,业务应用程序开发中有大量的Python编程用例。 考虑到有太多东西要学习,很容易迷失方向,想知道太多了。

In this article, I will take you through different programming paradigms Python supports and help you decide which one you should learn first.

在本文中,我将带您了解Python支持的不同编程范例,并帮助您确定应该首先学习哪个。

Programming Paradigm is a style or way to classify programming languages.

编程范例是对编程语言进行分类的一种样式或方式。

Python support three programming paradigms: Imperative, Functional, and Object-Oriented. Figure 1, shows features of each of these programming paradigms.

Python支持三种编程范例:命令式,函数式和面向对象。 图1显示了每种编程范例的功能。

Image for post
Figure 1: Python programming paradigms
图1:Python编程范例

势在必行(Imperative)

Imperative programming provides explicit steps to the computer using statements, loops, etc.

命令式编程使用语句,循环等为计算机提供了明确的步骤。

Image for post
Figure 2: Example of an imperative programming paradigm
图2:命令式编程范例示例

Below is an example of imperative programming. This is a simple instruction to the computer, how to concatenate characters provided in a list, and make a string.

下面是命令式编程的示例。 这是对计算机的简单说明,说明如何连接列表中提供的字符并创建字符串。

If you run the above statements and loop it will print

如果您运行上述语句并循环,它将打印

sanrusha

In imperative programming set of commands can be grouped in a code block also called Procedure.

在命令式编程中,命令集可以分组在一个代码块中,该代码块也称为Procedure

Image for post
Figure 3: An example of Procedural Programming paradigm
图3:过程编程范例的示例

Statements and loop in the above code can be grouped in a Procedure (Python method) like below.

上面的代码中的语句和循环可以按以下过程(Python方法)进行分组。

Now, the method stringc can be called with a list of characters as an argument.

现在,可以使用字符列表作为参数来调用stringc方法。

stringc([‘s’,’a’,’n’,’r’,’u’,’s’,’h’,’a’])

The above call will return

以上通话将返回

sanrusha

Now, the approach is modularized than before. While the procedure makes imperative programming modularized, state changes are either localized to a procedure or limited to the explicit argument or return from the procedure.

现在,该方法比以前模块化了。 当过程使命令式编程模块化时,状态更改将局部化到过程或限于显式自变量或从过程返回。

功能性 (Functional)

The functional programming paradigm is a style of programming that involves using built-in higher-order functions. A higher-order function takes other function as an argument or returns them as a result.

函数式编程范例是一种编程样式,涉及使用内置的高阶函数。 高阶函数将其他函数作为参数或将它们作为结果返回。

Python built-in functions like lambda, map, filter, generators, decorators, recursions are higher-order functions. As long as you know what you want, you can use the best-fit built-in python function to accomplish it in the lowest number of lines of code.

Python内置函数(例如lambda,map,filter,generator,decorator和recursions)是高阶函数。 只要您知道自己想要什么,就可以使用最适合的内置python函数以最少的代码行数来完成它。

Image for post
Figure 4: An example of the functional programming paradigm
图4:函数式编程范例的示例

The below code shows how to accomplish the same of combining characters into string in less than three lines of codes, by using Python higher-order functions like reduce and lambda.

下面的代码显示了如何通过使用诸如reduce和lambda之类的Python高阶函数来完成用不到三行代码将字符组合成字符串的相同操作。

Refer below link to get a complete list of built-in higher-order functions available in Python

请参阅下面的链接以获取Python中可用的内置高阶函数的完整列表

面向对象(Object-Oriented)

An object-oriented programming (OOP) paradigm is so famous that you have to put your best effort into ignorance to not know about it. One of the reasons, object-oriented programming became so famous is it makes the code reusable. This is like taking the blueprint of a building and constructing the building with your own preferences like the number of floors, color, flooring, etc.

面向对象编程(OOP)范例是如此著名,以至于您必须全力以赴地了解它。 原因之一是,面向对象的编程之所以如此著名,是因为它使代码可重用。 这就像拍摄建筑物的蓝图,并根据自己的喜好(例如楼层数,颜色,地板等)建造建筑物。

The blueprint in the case of OOP is called class. You are free to instantiate the class into an object with your own preferences. While you can not make a bike with a blueprint of a car, you can decide a lot of variations in the car while using the blueprint.

OOP情况下的蓝图称为类。 您可以根据自己的喜好随意将类实例化为对象。 虽然您无法使用汽车的蓝图制作自行车,但可以在使用汽车的蓝图时决定汽车的许多变化。

Python is full of built-in classes that you will use in your programs. While it is not easy to master OOP from day one, the good news is that you might not need to write an OOP program from scratch from day one in your job. For a few jobs, you might never need to write an OOP and your job might suffice by using built-in classes.

Python充满了将在程序中使用的内置类。 尽管从第一天开始掌握OOP并不容易,但是好消息是,从工作的第一天起,您可能不需要从头开始编写OOP程序。 对于一些工作,您可能永远不需要编写OOP,并且使用内置类就可以满足您的工作。

Image for post
Figure 5: An example of Python Object-Oriented Programming
图5:Python面向对象编程的示例

Below is an example of, how to accomplish the same task of creating a string out of characters with OOP.

下面是一个示例,说明如何完成使用OOP从字符中创建字符串的相同任务。

从哪儿开始? (Where to start?)

Now comes the question you have.

现在是您的问题。

Where to start?

从哪儿开始?

The answer depends on the job you are going to perform. Figure 6 shows the python programming paradigm you should focus on based on your job.

答案取决于您要执行的工作。 图6显示了您应根据工作重点关注的python编程范例。

Image for post
Figure 6: Programing paradigm to master for the job functions
图6:掌握工作职能的编程范例

Conclusion

结论

If you don’t know anything about programming and have a little idea of Python, start with an imperative paradigm and get knowledge of Functional programming. Knowledge of built-in higher-order python functions will help you a lot. Once you are comfortable with these paradigms, start exploring object-oriented programming.

如果您对编程一无所知,并且对Python有一点了解,请从命令式范例开始,并获得有关函数式编程的知识。 内置的高阶python函数的知识将对您有很大帮助。 一旦熟悉了这些范例,就开始探索面向对象的编程。

翻译自: https://towardsdatascience.com/python-what-to-learn-and-how-much-fb61bdef7b3a

学习python多少钱

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值