Home > other >  Novice learning Python basis function, often ignore the thing
Novice learning Python basis function, often ignore the thing

Time:11-16

2018年9月打算学Python,中间又回了老家,为适应新工作也就放一边了,当时经常刷某乎,在大神的推荐下,刚开始用的是"Begining Python",觉得老外写书好的一点,就是通俗易懂,容易上手,但是总感觉比较零碎,没有一个系统性,原理性的东西,总感觉没有入门,我又去某乎看看有没有适合自己的,19年找到了是现在使用的"Python crash course",每一步为什么,原理说的很清楚,解放了我的好奇心,书大约4月份就到了,我想可以安心学我的Python了,又遇上当时老板决定同时搞直播和抖音,讨论时我表示公司没有这个实力,原因很简单--没相关人才,没人懂抖音和直播,老板一定要做,于是我又自费报名某宝内容运营课程,大约到19年7月份学完课程,比较了解抖音和直播了,我建议找达人合作,思考具体方案:达人怎么找,怎么合作,使用哪几种方式,汇报上去,也被否决,原因是老板认为要花钱,同时效果无法预测,这样一直拖到年底疫情,终于有时间了,断断续续学完了前7章,前7章是基础的基础,第8章function感觉难度就上来了,虽然上学的时候还是比较喜欢函数,觉得函数很神奇,有图有真相,function章节看到一半,卡壳了,刚开始parameter比较迷惑,对function中body的构成也是研究了3天才明白,昨天在写8-9练习时,自认为代码都敲进去了,def写好了,parameter也设置了,讲义说复杂任务分部完成,用多个function,每个function只解决一个特定问题,这点也想到了,运行结果就是不对,代码如下:
Def print_messages (text_messages show_messages) :
While text_messages:
Current_messages=text_messages. Pop ()
Print (f "Printing message: {current_messages}")
Show_messages. Append (current_messages)

Def print_show_messages (show_messages) :
Print (" f \ nThe following messages have had printed: ")
For show_message show_messages in:
Print (show_message)

Text_messages=[" both Please forgive me, "" I 'm sorry," "Don' t hate me", "I knew it"]
Show_messages=[]

I compare notes case is found, finally need to add a custom function when funtion expressions initialization:
Print_messages (text_messages show_messages)
Print_show_messages (show_messages)
The content of the code execution result is def inside, why want to add the function name to display the results?

CodePudding user response:

Function need to be able to play a role in the process,
The first to define, is you the above part def
The next to be called, is the part that you write the following

Just like you to write a composition (programming), you must first define the word library (definition) of Chinese characters, to write articles to make sentences with words (call),

CodePudding user response:

System at two kinds of function, the user customization,
Systems, can be used directly, such as print (' XXX '), STR () and so on, the function of this kind of function is prepared in advance,
User-defined, define functions to realize the function of the first, is def functio () : the function, using the function ()

CodePudding user response:

Most of the programming language, function is the key, in python, and object-oriented class, come on,