古人云:书山有路勤为径 学海无涯苦作舟 。
注:一般标榜着 “ XX天学会XX”、“ XX 分钟了解XX”的文章都不会是让你增长功力的文章,如本文。
随着互联网发展,全球在快速数字化,编程这件事也从数十年前只有科研人研在实验室才能做的事变得越来越让人们所熟悉。但是作为平时甚少接触编程的小伙伴,是不是也会对计算机世界拥有一点点好奇心呢(比如电影《黑客帝国》、《源代码》)?
Q1: "怎么进入编程世界?"
首先,你要学会一门编程语言!
而我要推荐的计算机语言,答案已在标题中被出卖***hon!Python是一门十分容易上手,但是又被IT业界广泛使用的编程语言(Scratch这种图形化编程虽然简单,但基本只能用于教学)。2016年5月份Python在全球最受欢迎编程语言中排第五。
Q2: “Python如何学?”
如果你是一位从未接触过编程语言的新手,请移步 这里。 此书作者是一位程序员大叔,大叔说了:“学编程,首先,得会打字!!不会打字您就别学了哈”。大叔的在书提出的观点个人觉得也是值得学习的,无论用于编程还是其他事情,如:
As you study this book, and continue with programming, remember that anything worth doing is difficult at first. Maybe you are the kind of person who is afraid of failure so you give up at the first sign of difficulty. Maybe you never learned self-discipline so you can't do anything that's "boring." Maybe you were told that you are "gifted" so you never attempt anything that might make you seem stupid or not a prodigy. Maybe you are competitive and unfairly compare yourself to someone like me who's been programming for more than 20 years.
Whatever your reason for wanting to quit, keep at it. Force yourself. If you run into a Study Drill you can't do, or a lesson you just do not understand, then skip it and come back to it later. Just keep going because with programming there's this very odd thing that happens. At first, you will not understand anything. It'll be weird, just like with learning any human language. You will struggle with words, and not know what symbols are what, and it'll all be very confusing. Then one day BANG your brain will snap and you will suddenly "get it." If you keep doing the exercises and keep trying to understand them, you will get it. You might not be a master coder, but you will at least understand how programming works.”
万事开头难,但自己选择的路,即使跪着也要走完。也许你是那种一碰到困难就想到放弃的人;也许你从未掌握“自律”这件事导致你无法做任何“枯燥”的事情;也许你一直被认为是“天才”,所以你不会傻到尝试去做那些有可能让你看起来是一个笨蛋或者至少不是“神童”的事情;也许你觉得和我这种已经编程超过20年的人比较编程这件事是一件逗逼的事情。
无论是什么原因使你想要退出,不要管它!要管住自己(译者注:论“自虐”能力的重要性。)! 如果某一个练习你不会做,或者有一课你听不明白,那就跳过它,然后再回来重新学习(译者注:子曰:温故而知新)。编程这事说起来是件奇怪的事情,当你没有领悟真谛的时候你只需要坚持。像学习任何一门自然语言一样,刚开始时可能总会感觉怪怪的。那些奇怪的单词,那些你不知道的符号,也许会让你感到十分困惑。但只要你坚持不懈,坚持做本书中的那些练习并且尝试着去理解它们。会有一天,你的脑子会突然闪出“哇哈~!原来是这样!” 的顿悟时刻。也许你不会成为一个高级码农,但是至少你将会知道编程到底是什么鬼。
言归正传,本文面向对象为具有一丁点编程经验的小伙伴,旨在快速了解Python的基本语法和部分特性。
前言
1. 基本类型和运算符
2. 变量和集合
列表
元组
字典
集合
Python数据集合类型总结
列表 定义方式 li = [1,2,3,4,“Hello World”] (列表可以包含任意基本类型)
元组 定义方式 tup = (1,2,3,4) (和列表类似,但 元组不可更改)
字典 定义方式 dic = {“one”:2,“tow”:3,“three”:0}(字典,就是字典嘛。以 key:value 方式存在)
集合 定义方式 set=set(1,2,3,4)or set = {1,2,3,4} (集合里的元素是唯一的,集合支持 & | ^ + -操作)
3. Python 逻辑运算符
4. Functions
5. Python中的类
6. Python的模块(库)
7. Python中的高级特性(生成器、装饰器:wraps)
[1]learnxinyminutes,本文代码大部分取于该网站,在此对该网站作者表示感谢!
全部0条评论
快来发表一下你的评论吧 !