Python是最流行的编程语言之一,也是大学课程中最早教授的编程语言之一。如果你没有上大学(或者你想在入学前抢先一步),有很多方法可以让你自己和在家开始学习Python 。
本Python初学者教程应该可以帮助您开始努力学习Python。
为什么要学习 Python?
Python是一种面向对象的语言,其设计时考虑到了可读性。如果您以前看过一堵代码墙,您可能会发现它有点难以理解,除非您非常熟悉该语言。Python使用了大量的空格,这使得阅读代码行和辨别它们的目的变得容易。
Python也被构建为“可扩展的”。对于编程语言,这本质上意味着该语言可以轻松扩展以具有更多功能。Python使用更简单的语法和语法,使其易于理解,即使对于只有基本理解水平的初学者也是如此。
毫无疑问,您应该熟悉的东西是“ Python 之禅”,这是(Zen of Python)Python围绕的一组 19 种设计哲学。不必背诵它们,但花时间阅读列表。
诸如“美胜于丑”和“显式胜于隐式”之类的想法是正确编码的关键。
学习 Python 的第一步
如果您是第一次涉足编程,您可以阅读大量面向初学者的Python教程,但最好的方法是通过交互式教程进行学习。任何编程语言都涉及了解语法(语言中使用的特定单词和命令集)、语言整体工作的逻辑等等。
有很多东西需要吸收。谈到编码,熟能生巧。亲身体验比阅读在线指南更有价值。一步一步做事,一次只专注于学习一个方面。
学习语法。(Learn the syntax.)
在使用Python编写任何代码之前,您需要了解该语言的语法。从最基本的代码行开始:打印命令。(Start)它看起来像这样:
打印(“你好世界!”)
这行代码打印出这句话:Hello world!
与括号和引号结合的命令 print 告诉编译器该做什么。如果您输入的内容不正确,该命令将不起作用,并且很可能会引发所谓的语法错误。
了解变量。(Understand variables.)
除了基本语法之外,Python(以及几乎所有其他编程语言)使用变量来表示存储位置。换句话说,变量可以存储用户或程序给它的信息。这是一个例子。
x = 4
y = 5
打印(x+y)
程序运行时会显示数字9。为什么?因为它添加了变量 x(分配了数字 4)和 y(分配了 5),总共 9。
Python 教程
了解语法和变量是任何编程语言的良好开端,但真正了解其工作原理的最佳方式是亲自尝试。以下是 Internet 上一些最好的 Python 教程的列表。
Codecademy有许多课程可用于各种不同的编程语言。有免费课程和付费课程。如果您希望获得结业证书,则需要参加其中一门高级课程——但免费的Python教程是很好的起点。
W3Schools是网络上最重要的编程信息来源之一。它包含许多指导网页设计和编程的标准。它还包含Python的自行尝试教程,将指导您完成基础知识。
Python Wiki是另一个很好的资源,用于学习几乎所有你能想象到的关于Python的东西。除了基本的Python课程外,它还包含很多关于如何为更高级的应用程序实现该语言的信息。
Udemy是一个著名的自学平台。Udemy Python Bootcamp(Udemy Python Bootcamp)是一门课程,指导用户从基础知识到设计游戏和软件等专业级应用程序。通过 140 美元的价格,这门课程有 20 多个小时的视频课程和 19 个编码练习,可以教你需要知道的一切。
Google Python课程是为已经有一点编程经验的人开设的免费课程。它在Google作为为期两天的强化课程教授,但您可以按照自己的进度学习这些材料。它不会带您达到专业水平,但它会让您入门。
蟒蛇机会
在撰写本文时,Indeed.com 上提供了 60,000 多个与 Python 相关的工作——(Indeed.com—and)这是一个单一的工作站点。编程语言与日俱增,机会也在增加。
如果你有兴趣开始作为一名Python开发人员的职业,或者你只是想成为一名编码员,那么Python是一个很好的起点。利用(Take)此处列出的资源自学有关Python编码和编程的所有知识。
A Python Tutorial For Beginners: How To Get Started
Python is one of the most popular programming languages, and one of the first ones taught in college-level сourses. If you aren’t in college (or you want to get a headstart before enrolling), there are plеnty оf wayѕ to get started learning Python by yourself and at home.
This Python tutorial for beginners should help you get started with your efforts to learn Python.
Why Learn Python?
Python is an object-oriented language that was designed with readability in mind. If you’ve ever looked at a wall of code before, you may have found it somewhat hard to follow unless you were intimately acquainted with the language. Python utilizes significant amounts of whitespace that makes it easy to read the lines of code and discern their purpose.
Python is also built to be “extensible.” With regard to programming languages, this essentially means how easily the language can expand to have more functionality. Python uses simpler syntax and grammar that makes it easy to understand, even for a beginner with only a base-level of understanding.
Something you should familiarize yourself with that will undoubtedly come up is the “Zen of Python,” a set of 19 design philosophies that Python is centered around. It isn’t necessary to know them by heart, but take the time to read over the list.
Ideas like “Beautiful is better than ugly,” and “Explicit is better than implicit,” are keys to proper coding.
Step One to Learning Python
If you are diving into programming for the first time, you can read plenty of Python tutorials for beginners, but the best way is to learn through an interactive tutorial. Any programming language involves getting to know the syntax (the specific set of words and commands used in the language), the logic of how the language works as a whole, and much more.
It’s a lot to take in. When it comes to coding, practice makes perfect. Hands-on experience is more valuable than reading it in an online guide. Take things one step at a time and focus on learning one aspect at a time.
Learn the syntax.
Before you can code anything in Python, you need to know the syntax of the language. Start with the most basic line of code: the print command. It looks like this:
print(“Hello world!”)
This line of code prints out the phrase: Hello world!
The command print combined with the parentheticals and the quotation marks tell the compiler exactly what to do. If you entered something incorrectly, the command would not work and would most likely throw what is known as a syntax error.
Understand variables.
Aside from basic syntax, Python (and almost all other programming languages) use variables to denote storage locations. In other words, a variable can store information given to it by the user or by a program. Here’s an example.
x = 4
y = 5
print(x+y)
When the program runs, it will display the number 9. Why? Because it added the variables x (which was assigned the number 4) and y (which was assigned 5), which total 9.
Python Tutorials
Understanding syntax and variables is a strong start to any programming language, but the best way to truly understand how it works is to try for yourself. The following is a list of some of the best Python tutorials on the internet.
Codecademy has numerous courses available for a variety of different programming languages. There are both free and paid courses. If you wish to receive a certificate of completion, you’ll need to take one of the premium courses–but the free Python tutorials are great places to start.
The W3Schools is one of the foremost sources for programming information on the web. It contains many of the standards that guide web design and programming. It also has try-it-yourself tutorials for Python that will guide you through the basics.
The Python Wiki is another great resource for learning nearly anything you can imagine about Python. In addition to basic Python courses, it contains a lot of information about how to implement the language for more advanced applications.
Udemy is a renowned platform for self-education. The Udemy Python Bootcamp is a course that guides users from the very basics to professional-level applications such as designing games and software. Through pricey at $140, this course has more than 20 hours of video courses and 19 coding exercises to teach you everything you need to know.
The Google Python class is a free course for people that already have a bit of programming experience. It’s taught at Google as an intensive two-day course, but the material can be learned at your own pace. It won’t take you to a professional level, but it will get you started.
Python Opportunities
At the time of writing this article, more than 60,000 Python-related jobs are available through Indeed.com—and that’s a single job site. The programming language grows in popularity with each passing day, as does the opportunity.
If you are interested in starting a career as a Python developer or you just want to get your foot in the door as a coder, Python is a great place to start. Take advantage of the resources listed here to teach yourself all you need to know about coding and programming in Python.