<p>让我们从简单开始,您得到一些语句,让我们将其解析为简单的部分,并将其连接到Python世界</p>
<ul>
<li><p>定义存根</p>
<blockquote>
<p>noun Something cut short or arrested in development. (<a href="https://www.wordnik.com/words/stub" rel="nofollow noreferrer">source</a>)</p>
</blockquote>
</li>
<li><p>对于函数<code>get_user_num()</code>和<code>compute_avg()</code></p>
<blockquote>
<p>The keyword def introduces a function definition. It must be followed by the function name and the parenthesized list of formal parameters. The statements that form the body of the function start at the next line, and must be indented. (<a href="https://docs.python.org/3/tutorial/controlflow.html#defining-functions" rel="nofollow noreferrer">source</a>)</p>
</blockquote>
</li>
<li><p>每个存根都应该打印</p>
<p>检查如何使用Python将内容输出到控制台</p>
</li>
<li><p>接着是一条新线</p>
<p>如中所示,不要使两个<code>FIXME</code>行像这样相互折叠:<code>FIXME: somethingFIXME: something else</code></p>
<blockquote>
<p>the Unix end-of-line convention '\n', the Windows convention '\r\n', and the old Macintosh convention '\r'...
(<a href="https://docs.python.org/3/glossary.html#term-universal-newlines" rel="nofollow noreferrer">source</a>)</p>
</blockquote>
</li>
<li><p>并且应该返回<code>-1</code></p>
</li>
<li><p>每个存根还必须包含函数的参数</p>
<p>任何地方都没有定义。所以,要么使用你通常用来做数学函数的东西,要么喜欢</p>
</li>
<li><p>两次调用<code>get_user_num()</code>和一次调用<code>compute_avg()</code>的示例输出:</p>
<p>这就是最终程序执行后的行为方式。调用函数时,首先要确保函数已在前面定义,然后写入其名称+<code>()</code>,例如<code>func()</code></p>
<p>根据未定义的func参数和两个相关函数判断,您可能希望直接连接这两个函数,或者使用包含结果的中间项连接这两个函数</p>
</li>
</ul>
<p>完成这些步骤后,您应该能够创建最终程序。不要试图立即创建它,将项目符号作为小步骤使用,并始终检查文件是否仍然有效(正确执行)。必要时创建多个文件(复制粘贴)</p>
<p>没有人关心它在发展中的样子。你在学习,你最终会变得更好</p>