<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>NotionNext BLOG</title>
        <link>https://heliang.fun/</link>
        <description>这是一个由NotionNext生成的站点</description>
        <lastBuildDate>Tue, 22 Aug 2023 05:45:33 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2023, heliang</copyright>
        <item>
            <title><![CDATA[Python基础语法案例]]></title>
            <link>https://heliang.fun/article/07205a14-4c89-44ba-ac11-955bbd61959b</link>
            <guid>https://heliang.fun/article/07205a14-4c89-44ba-ac11-955bbd61959b</guid>
            <pubDate>Fri, 02 Jul 2021 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-07205a144c8944baac11955bbd61959b"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-8c3d6e521e7b4902a05620a4a43d0b4f" data-id="8c3d6e521e7b4902a05620a4a43d0b4f"><span><div id="8c3d6e521e7b4902a05620a4a43d0b4f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8c3d6e521e7b4902a05620a4a43d0b4f" title="比较运算符"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">比较运算符</span></span></h4><ul class="notion-list notion-list-disc notion-block-047a82a67c0144d79d2eaf0965c1ca8a"><li>如果比较条件成立的话就是True，不成立则是False。</li></ul><ul class="notion-list notion-list-disc notion-block-80774fbd78694b75944aa8e6bef21299"><li>if语句的基本格式</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-deb762163e5a40cfb3799bc1d6afe04e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="74b280eb-69f6-4246-bea0-41b0f5fcdaf9.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-e4543e9683044ef388dc63ea79ff8e7f" data-id="e4543e9683044ef388dc63ea79ff8e7f"><span><div id="e4543e9683044ef388dc63ea79ff8e7f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e4543e9683044ef388dc63ea79ff8e7f" title="if语句的注意事项："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">if语句的注意事项：</span></span></h4><ul class="notion-list notion-list-disc notion-block-16c6e1198e444b5682601615a6d34548"><li>判断条件的结果一定要是布尔类型（True）（False）。</li></ul><ul class="notion-list notion-list-disc notion-block-c4eaa52dcc544cfda0c106cf0ccaf649"><li>要记得在条件语句后的：冒号。</li></ul><ul class="notion-list notion-list-disc notion-block-2e24d93a620d4c718bea2c9372314e8f"><li>归属于if语句的代码块，需在前方填充4个空格缩进。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-9c4ed2e849fe46c4bbe8c86578b3b451" data-id="9c4ed2e849fe46c4bbe8c86578b3b451"><span><div id="9c4ed2e849fe46c4bbe8c86578b3b451" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9c4ed2e849fe46c4bbe8c86578b3b451" title="if else语句的注意事项："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">if else语句的注意事项：</span></span></h4><ul class="notion-list notion-list-disc notion-block-8bab7afb4628406b936f8b5cb2b55504"><li>else后不需要写条件语句（最后执行）。</li></ul><ul class="notion-list notion-list-disc notion-block-54ee9e4c54504caba46679832863558d"><li>else后面要加上：冒号。</li></ul><ul class="notion-list notion-list-disc notion-block-793e7dcf58884573954259592e755347"><li>属于和if的代码块同级，也是需要在前方填充4个空格缩进。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-0373dcfe660249498e40ffe87bd3ce8a" data-id="0373dcfe660249498e40ffe87bd3ce8a"><span><div id="0373dcfe660249498e40ffe87bd3ce8a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0373dcfe660249498e40ffe87bd3ce8a" title="if elif else 语句的作用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">if elif else 语句的作用</span></span></h4><ul class="notion-list notion-list-disc notion-block-d5031aaa0f004d859ac38c0acb525326"><li>可以完成多个条件的判断。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-97af8ef545e144bc9440b8901c1162ab" data-id="97af8ef545e144bc9440b8901c1162ab"><span><div id="97af8ef545e144bc9440b8901c1162ab" class="notion-header-anchor"></div><a class="notion-hash-link" href="#97af8ef545e144bc9440b8901c1162ab" title="使用if elif else的注意事项"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">使用if elif else的注意事项</span></span></h4><ul class="notion-list notion-list-disc notion-block-404c4a687cf344048dc54d3dd59d6d26"><li>elif可以嵌套多个判断条件。</li></ul><ul class="notion-list notion-list-disc notion-block-b8c2aacf48874a9288bd6ce2b3ae49e3"><li>判断是互斥有序的，从上到下，上一个满足后面的就不会判断了。</li></ul><ul class="notion-list notion-list-disc notion-block-8ccc5695f5e1485c93a12657ebd9c24a"><li>可以在条件判断中，直接写input语句，节省代码量。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-a865c4ab53ca4f2d9a31e87178b4e928" data-id="a865c4ab53ca4f2d9a31e87178b4e928"><span><div id="a865c4ab53ca4f2d9a31e87178b4e928" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a865c4ab53ca4f2d9a31e87178b4e928" title="嵌套判断语句"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">嵌套判断语句</span></span></h4><ul class="notion-list notion-list-disc notion-block-5ed45835f6bf4810bbce7121164139ed"><li>嵌套判断语句可以用于多条件，多层次的逻辑判断。</li></ul><ul class="notion-list notion-list-disc notion-block-47b62dc1092445e9bdade3faef5543b7"><li>嵌套判断语句可以根据需求，自由组合if elif else来构建多层次判断。</li></ul><ul class="notion-list notion-list-disc notion-block-27d662f0ee8e4e49b27787575be1986c"><li>嵌套判断语句，一定要注意空格缩进，Python通过空格缩进来决定层次关系。</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-b7d09f8019cc4a9a8b82c7e6ff36d4ff"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="e72ffbbb-c1a7-4bbe-b160-d87b3262745e.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-7aa546c8c8fe4d02b162e37842002c74" data-id="7aa546c8c8fe4d02b162e37842002c74"><span><div id="7aa546c8c8fe4d02b162e37842002c74" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7aa546c8c8fe4d02b162e37842002c74" title="while循环的格式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">while循环的格式</span></span></h4><ul class="notion-list notion-list-disc notion-block-1a242efd15dc47428fc7c265463681fa"><li>循环条件的输出时布尔类型</li></ul><ul class="notion-list notion-list-disc notion-block-440e6d7076ef4e60bce80a6a827464fe"><li>i+=1是递增的意思</li></ul><ul class="notion-list notion-list-disc notion-block-e6bb6d3dd41b4ce5818290fa742cac3f"><li>i=0是初始化i的值</li><ul class="notion-list notion-list-disc notion-block-e6bb6d3dd41b4ce5818290fa742cac3f"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-83a19da67be7414ca9a66451cfa7a7e2"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="55c8aa84-4a81-49fb-8342-c26c91c55111.png" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-a847f5daf95848bfa8957f380471f1fa" data-id="a847f5daf95848bfa8957f380471f1fa"><span><div id="a847f5daf95848bfa8957f380471f1fa" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a847f5daf95848bfa8957f380471f1fa" title="嵌套while循环注意事项"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">嵌套while循环注意事项</span></span></h4><ul class="notion-list notion-list-disc notion-block-aa7715c5c56640ebb252a6ff2702d329"><li>和判断语句一样都是需要空格缩进来决定层次关系。</li></ul><ul class="notion-list notion-list-disc notion-block-e5511682cb2c4ccf9c56802d916a409b"><li>注意内外条件的控制，不然容易出现死循环。</li></ul><ul class="notion-list notion-list-disc notion-block-c7c08534abe0440cb87fe5199ede8b3c"><li>循环条件的控制，层次越多越复杂，需要细心耐心。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-61a5a6332ca64df4bf45bf4282b8d128" data-id="61a5a6332ca64df4bf45bf4282b8d128"><span><div id="61a5a6332ca64df4bf45bf4282b8d128" class="notion-header-anchor"></div><a class="notion-hash-link" href="#61a5a6332ca64df4bf45bf4282b8d128" title="for循环格式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">for循环格式</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-46c569250e774a9dadc2354700823e84"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="d36bbacd-0f44-4f56-ba03-85f7e0b70143.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><ul class="notion-list notion-list-disc notion-block-aa2c8374b89d407fb5c029e087658cfe"><li>语法中的:待处理数据集，严格来说，称之为序列类型，序列类型是指，其内容可以一个个依次取出的一种类型，包括：字符串，列表，元组，等。</li></ul><ul class="notion-list notion-list-disc notion-block-6a93ae4698234e48bdab7dfe51e2d17a"><li>for循环语句，本质上是遍历：序列类型。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-97fe0ad3ad1548f68863d8a09769e337" data-id="97fe0ad3ad1548f68863d8a09769e337"><span><div id="97fe0ad3ad1548f68863d8a09769e337" class="notion-header-anchor"></div><a class="notion-hash-link" href="#97fe0ad3ad1548f68863d8a09769e337" title="for循环的注意事项"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">for循环的注意事项</span></span></h4><ul class="notion-list notion-list-disc notion-block-c461e49740924e1793fb6c4632691b9c"><li>无法定义循环条件，条件是根据数据集里面的内容决定的，只能别动取出数据处理。</li></ul><ul class="notion-list notion-list-disc notion-block-e15c9c7c8a1c4911b8ce40be42e00294"><li>和while循环一样，循环内的语句需要有空格缩进。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-f7993e0df04e46709e3eba847d464c6f" data-id="f7993e0df04e46709e3eba847d464c6f"><span><div id="f7993e0df04e46709e3eba847d464c6f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f7993e0df04e46709e3eba847d464c6f" title="range的功能"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">range的功能</span></span></h4><ul class="notion-list notion-list-disc notion-block-9d5f7e1cffcf492ca59c88005e0c5983"><li>获得一个数字序列（一个范围）</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-d500f48e9a1f4ce0b21d3ea0a9d98594" data-id="d500f48e9a1f4ce0b21d3ea0a9d98594"><span><div id="d500f48e9a1f4ce0b21d3ea0a9d98594" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d500f48e9a1f4ce0b21d3ea0a9d98594" title="range的三种语法："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">range的三种语法：</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-969eb2fc262a461295a20f6e6e6a62bf"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="e1e20fa4-5cdc-4e8b-bde4-4a499643e5ea.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-621de40ea5a84f678ea31a94b3ea31fa"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="ecb5887f-e02b-485b-9072-f80ef19c3af5.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2448ec0c127c499e8c8478501eb006d3"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="62c20c99-7d4b-4bef-b039-593a0a40a2b1.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-545764692e264b39acd705b4bd03bea6" data-id="545764692e264b39acd705b4bd03bea6"><span><div id="545764692e264b39acd705b4bd03bea6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#545764692e264b39acd705b4bd03bea6" title="range的作用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">range的作用</span></span></h4><ul class="notion-list notion-list-disc notion-block-56cf4334e0034c35a3edcca1d0710020"><li>主要是利用range来配合for循环使用，可以快速的确定for要循环的次数，来完成一些特定的需求。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-aff3e19960894060a6c1056274de5749" data-id="aff3e19960894060a6c1056274de5749"><span><div id="aff3e19960894060a6c1056274de5749" class="notion-header-anchor"></div><a class="notion-hash-link" href="#aff3e19960894060a6c1056274de5749" title="for循环中的临时变量"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">for循环中的临时变量</span></span></h4><ul class="notion-list notion-list-disc notion-block-efe37112d4e948f494228bd80094060f"><li>它的作用域限定为循环内。</li></ul><ul class="notion-list notion-list-disc notion-block-1bc31adb2e764acc9a31d922f51beddf"><li>这种限定是编程的软规定，而非强制限定。</li></ul><ul class="notion-list notion-list-disc notion-block-ad178f9777c3443b8b39c7d79e55acf0"><li>不遵守也能正常运行，但不建议这么做。</li></ul><ul class="notion-list notion-list-disc notion-block-71bb05bfa46c4f58839c4d9eaa40ef57"><li>如需访问for循环体内的临时变量，可以预先在循环外定义它。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-bda776a89d964946871c51e51e305e4c" data-id="bda776a89d964946871c51e51e305e4c"><span><div id="bda776a89d964946871c51e51e305e4c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#bda776a89d964946871c51e51e305e4c" title="循环中continue和break的作用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">循环中continue和break的作用</span></span></h4><ul class="notion-list notion-list-disc notion-block-3808b472a4904c5ba12b7925b3c3c8df"><li>continue的作用是中断所在循环的当前执行，直接进入下一次。（临时中断）</li></ul><ul class="notion-list notion-list-disc notion-block-08f8deb2218440cb85a5d526b49ba648"><li>break的作用是直接结束所在的循环。（永久中断）</li></ul><ul class="notion-list notion-list-disc notion-block-73bfea9cbd60496583cce52bbabde3ab"><li>continue和break在for和while循环中的作用一致。</li></ul><ul class="notion-list notion-list-disc notion-block-c42372446665448e86f3a06af3fac381"><li>在嵌套循环中只能作用在所在的循环上，无法对上层循环起作用。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-ec67392528ba4eb29f59c2ce07297872" data-id="ec67392528ba4eb29f59c2ce07297872"><span><div id="ec67392528ba4eb29f59c2ce07297872" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ec67392528ba4eb29f59c2ce07297872" title="continue和break应用案例:"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">continue和break应用案例:</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-77328ebe20eb4f3da482323493a6f180"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="490d7eee-5f95-4cc5-b9b6-3188f8e317fd.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-73c8eb8fbf7a4ffe9fefc0c0c95cf7dd" data-id="73c8eb8fbf7a4ffe9fefc0c0c95cf7dd"><span><div id="73c8eb8fbf7a4ffe9fefc0c0c95cf7dd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#73c8eb8fbf7a4ffe9fefc0c0c95cf7dd" title="函数的功能"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数的功能</span></span></h4><ul class="notion-list notion-list-disc notion-block-8bccf2a435034c73a3a38e6a197e3da9"><li>函数是组织好的，可以重复使用的，用来实现特定功能的代码段。</li></ul><ul class="notion-list notion-list-disc notion-block-78540a73cac74fbe9dd3133c88940ddf"><li>使用函数的好处是能将功能封装在函数内，可供随时随地重复利用。</li></ul><ul class="notion-list notion-list-disc notion-block-e816646f69b74569bf56b4e10c26dfea"><li>可以提高代码的复用性，减少重复代码，提高开发效率。</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-e4e7d177d33b4207aa8d7c8ca56c74f0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="b14f3aca-efc9-4205-8311-1fbbbc4bf537.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-739946ba7444403c9d218b32622896fb" data-id="739946ba7444403c9d218b32622896fb"><span><div id="739946ba7444403c9d218b32622896fb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#739946ba7444403c9d218b32622896fb" title="函数的定义"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数的定义</span></span></h4><ul class="notion-list notion-list-disc notion-block-57795debc0c4478b934fc81e9d97460b"><li>定义格式通过def关键字和函数名定义，可以通过括号写入传入参数，然后写入函数体，最后return返回值，同时也是要缩进。</li></ul><ul class="notion-list notion-list-disc notion-block-ba8df13c02d74f2aa02250108de2d51e"><li>使用步骤要先定义函数后才可以调用函数。</li></ul><ul class="notion-list notion-list-disc notion-block-ad08985ac59b4bc3be7b544e08e49dba"><li>参数（括号不能省略但参数可以）和返回值不需要可以省略。</li></ul><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-91325e09108841caa2d9fe6b73dde2a6" data-id="91325e09108841caa2d9fe6b73dde2a6"><span><div id="91325e09108841caa2d9fe6b73dde2a6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#91325e09108841caa2d9fe6b73dde2a6" title="函数的传入参数"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数的传入参数</span></span></h2><ul class="notion-list notion-list-disc notion-block-acaf93412bd24440b2a1bc2c812632d9"><li>作用是在函数运行时，接受外部传入的数据。</li></ul><ul class="notion-list notion-list-disc notion-block-c57ec2f84cea441990a0f3fc7ef6e39e"><li>使用方式</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ef240776606e40fa887707069f5bb7fb"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="64b35950-2e4d-435f-96b1-b220e73dda4e.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><ul class="notion-list notion-list-disc notion-block-745560a4801749a9aaaac590d00f03fb"><li>函数定义中的参数也称之为形式参数，调用中的参数称之为实际参数。</li></ul><ul class="notion-list notion-list-disc notion-block-a3de595b87fe46389ed75c16de380d34"><li>函数的参数数量不限，传入参数的时候，要和形式参数相对应，用逗号隔开。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-f18359345f7d46ebac5af3b5cf477242" data-id="f18359345f7d46ebac5af3b5cf477242"><span><div id="f18359345f7d46ebac5af3b5cf477242" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f18359345f7d46ebac5af3b5cf477242" title="函数的返回值"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数的返回值</span></span></h4><ul class="notion-list notion-list-disc notion-block-883cc84997bb4d04ad1f763a6ced3fe0"><li>函数的返回值是函数在执行完成后，返回给调用者的结果。</li></ul><ul class="notion-list notion-list-disc notion-block-0e7c73e2b1d04b779740d83d8f9de6cd"><li>应用的语法是关键字：return 来返回结果。</li></ul><ul class="notion-list notion-list-disc notion-block-e96f899c1836478694c5d46878576260"><li>需要注意的是函数体遇到return后结束了，所以写在return后的代码不会执行。</li></ul><ul class="notion-list notion-list-disc notion-block-212598e4d7724ab1883cb2f459377199"><li>函数返回值的格式：</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-7abf337aac894989a5951a2846ec7691"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="efbb6c08-712d-42b3-840c-c873247f3b3a.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-317eddef504b4282a904054de792699d" data-id="317eddef504b4282a904054de792699d"><span><div id="317eddef504b4282a904054de792699d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#317eddef504b4282a904054de792699d" title="None"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">None</span></span></h4><ul class="notion-list notion-list-disc notion-block-fa4a7cfad9a64c518ec99518400894d9"><li>None是类型&#x27;NoneType&#x27;的字面量，用于表示：空的、无意义的。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-8d9316488ab44e0e8086eeea746cb845" data-id="8d9316488ab44e0e8086eeea746cb845"><span><div id="8d9316488ab44e0e8086eeea746cb845" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8d9316488ab44e0e8086eeea746cb845" title="函数如何返回None"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数如何返回None</span></span></h4><ul class="notion-list notion-list-disc notion-block-2bd21cce7fbc4e4abea9a5eb4231a82f"><li>不使用return语句即返回None。</li></ul><ul class="notion-list notion-list-disc notion-block-0e3a86937d234806ba6a75d1a655074c"><li>主动return None。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-725f18677210409fa1d4cdf535a3db3d" data-id="725f18677210409fa1d4cdf535a3db3d"><span><div id="725f18677210409fa1d4cdf535a3db3d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#725f18677210409fa1d4cdf535a3db3d" title="使用场景"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">使用场景</span></span></h4><ul class="notion-list notion-list-disc notion-block-0baf0e1ea28044c2be08aed3e47011c3"><li>函数的返回值。</li></ul><ul class="notion-list notion-list-disc notion-block-af1b38b59e7e425d97e016f652fdd2af"><li>if判断。</li></ul><ul class="notion-list notion-list-disc notion-block-51dd8e6ce0f14dadbb070696e05e4752"><li>变量定义（临时占位）。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-9539bca6304844568daa86d69fada445" data-id="9539bca6304844568daa86d69fada445"><span><div id="9539bca6304844568daa86d69fada445" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9539bca6304844568daa86d69fada445" title="函数说明文档"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数说明文档</span></span></h4><ul class="notion-list notion-list-disc notion-block-da76e7ed68a948d4a329b5e197c3b8e8"><li>它的作用是对函数进行说明解释，帮助更好理解函数的功能。</li></ul><ul class="notion-list notion-list-disc notion-block-70b994b03c2a4f2a8456a414013e08ff"><li>函数文档的定义语法：param用于解释参数，return用于解释返回值。</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-9501ce3806f84bb7816fdb205ae0ad68"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="3c69e956-de00-4a1c-85b6-fbd24b13e103.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-2e3b97b0dbef42fa9e8303b49c6649e8" data-id="2e3b97b0dbef42fa9e8303b49c6649e8"><span><div id="2e3b97b0dbef42fa9e8303b49c6649e8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2e3b97b0dbef42fa9e8303b49c6649e8" title="嵌套调用函数"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">嵌套调用函数</span></span></h4><ul class="notion-list notion-list-disc notion-block-dc820085c859455db77e03f3b9979dbd"><li>嵌套函数是在一个函数中调用另外一个函数。</li></ul><ul class="notion-list notion-list-disc notion-block-2ac702e5c9d3484ea7877e41bda08e65"><li>执行的流程:函数A中执行到调用函数B的语句，会将函数B全部执行完成后，继续执行函数A的剩余内容。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-53113bbbc2184bbe987937295fea9d7a" data-id="53113bbbc2184bbe987937295fea9d7a"><span><div id="53113bbbc2184bbe987937295fea9d7a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#53113bbbc2184bbe987937295fea9d7a" title="函数变量的作用域"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数变量的作用域</span></span></h4><ul class="notion-list notion-list-disc notion-block-571cd4e1ad5f41af981f899901acb67b"><li>局部变量（函数内定义的变量）作用范围在函数内部，在函数外部无法使用。</li></ul><ul class="notion-list notion-list-disc notion-block-57d599c27426459299906d6d19c90d2b"><li>全局变量（在函数外定义的变量）在函数内部和外部均可使用。</li></ul><ul class="notion-list notion-list-disc notion-block-788963ded26247448c9d7142fc71354c"><li>使用global关键字（格式：global+变量名）可以将函数内定义的变量声明为全局变量。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-4c84d209930a4f6ba29e3419499bb28c" data-id="4c84d209930a4f6ba29e3419499bb28c"><span><div id="4c84d209930a4f6ba29e3419499bb28c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#4c84d209930a4f6ba29e3419499bb28c" title="Python的数据容器"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Python的数据容器</span></span></h4><ul class="notion-list notion-list-disc notion-block-135bc30e72714582852e7fc4c4e2bad6"><li>它是一种可以存储多个元素的Python数据类型。</li></ul><ul class="notion-list notion-list-disc notion-block-86fa6f335dae417a827cb111e64de685"><li>数据容器分别有五个，list（列表）、tuple（元组）、str（字符串）、set（集合），dict（字典）。</li></ul><ul class="notion-list notion-list-disc notion-block-9bb9ef5aa39045bf926050674ca77fc5"><li>五个数据类型都有各自的特点，但都满足可容纳多个元素的特征。</li></ul><ul class="notion-list notion-list-disc notion-block-31c448c2db0b418ebc811d94aa45ba86"><li>五个数据类型都支持for循环，没有下标索引的数据类型不支持while循环。</li></ul><ul class="notion-list notion-list-disc notion-block-58e505e276ec489db0a8e2efb311d70e"><li>容器通用排序功能：sorted(容器,[reverse=True])，将给指定容器进行排序（键入True，false控制大小排序）。</li></ul><ul class="notion-list notion-list-disc notion-block-66af75c91bbf4c9e8dd21f3fec42ded7"><ul class="notion-list notion-list-disc notion-block-66af75c91bbf4c9e8dd21f3fec42ded7"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-696e31888be1457491fa94e66ecb4e0d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="0a332ee2-c737-4b5c-ae72-769341745f75.png" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><ul class="notion-list notion-list-disc notion-block-9761e9d8711c44acb0e632775a79c774"><ul class="notion-list notion-list-disc notion-block-9761e9d8711c44acb0e632775a79c774"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-71a609548ed0464dbd28257dcd8d7106"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="e506c7d5-bf97-46c3-982c-2bd9369e82d1.png" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><ul class="notion-list notion-list-disc notion-block-961b5a4cf99847da97a7c85c9a687093"><ul class="notion-list notion-list-disc notion-block-961b5a4cf99847da97a7c85c9a687093"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-82a9dc678f524270bc6a39938fbfc83f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="cc82e76c-81f7-4087-9d38-0a0109c88f45.png" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><ul class="notion-list notion-list-disc notion-block-779ef1bcb0654546b222f367e1e89cdc"><ul class="notion-list notion-list-disc notion-block-779ef1bcb0654546b222f367e1e89cdc"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-916c7a9af3914c73a83d71598acbb332"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="c65055cb-c1c2-4641-916d-c2f67aaf961f.png" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-fee341e248f84d768dbab0214e5315e4" data-id="fee341e248f84d768dbab0214e5315e4"><span><div id="fee341e248f84d768dbab0214e5315e4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#fee341e248f84d768dbab0214e5315e4" title="数据类型——列表（list）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据类型——列表（list）</span></span></h4><ul class="notion-list notion-list-disc notion-block-31a2d4c4fe2a4241b99b38e1575969f4"><li>列表的定义语法:name_list = [元素1,元素2，元素3，....]。</li></ul><ul class="notion-list notion-list-disc notion-block-b9ec5c1d1f754302979f3e74a539dee3"><li>元素：数据容器内的每一份数据，都称之为元素。</li></ul><ul class="notion-list notion-list-disc notion-block-a26516f2dad84d99bb3b2b6b77d5125e"><li>列表元素的数据类型没有任何限制，元素里面也可以是列表，这样的定义称之为嵌套列表。</li></ul><ul class="notion-list notion-list-disc notion-block-0659af3e48344944b3c222fec0bdeab8"><li>列表可以容纳多个元素（几百亿，可以理解成无上限）。</li></ul><ul class="notion-list notion-list-disc notion-block-f8a1c09f03114f47bf09c32521a42d5d"><li>列表是允许重复数据存在的。</li></ul><ul class="notion-list notion-list-disc notion-block-b409bc7b80fc4adf99b6140015704170"><li>列表可以修改（增加或删除元素等）。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-2776758d4de0443d889e7001ded6921f" data-id="2776758d4de0443d889e7001ded6921f"><span><div id="2776758d4de0443d889e7001ded6921f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2776758d4de0443d889e7001ded6921f" title="列表的下标索引"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">列表的下标索引</span></span></h4><ul class="notion-list notion-list-disc notion-block-22cdf620990f4d1d8493e43fcaa89688"><li>列表的每一个元素都有编号称之为下标索引。</li></ul><ul class="notion-list notion-list-disc notion-block-51f19a64240e4b1182bd1f50d35f710d"><li>寻找元素可以从前向后的方向编号从0开始递增，从后向前的方向，编号从-1开始递减。</li></ul><ul class="notion-list notion-list-disc notion-block-1c413dee7af34ebe9232642b047ce457"><li>通过下标索引取出元素的格式：列表[下标]。既可取出。</li></ul><ul class="notion-list notion-list-disc notion-block-5278a20e913545d5824cbe941794b121"><li>要注意下标索引的取值范围，超出取值范围无法取出元素，并且会报错。</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ab41eaa9a5b64a9e9e65d96f2e8d4c51"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="4e253d59-e35b-4909-afb8-8fcd4ddf8aab.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-1330173365834a26b5cd324c9f8f938c" data-id="1330173365834a26b5cd324c9f8f938c"><span><div id="1330173365834a26b5cd324c9f8f938c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1330173365834a26b5cd324c9f8f938c" title="数据类型——元组（tuple）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据类型——元组（tuple）</span></span></h4><ul class="notion-list notion-list-disc notion-block-cbd7a48eda084f35804f8de4b36aa562"><li>元组定义：使用小括号，使用逗号隔开各个数据，只有一个元素的时候要在第一个元素后面加个逗号才算是元组数据。</li></ul><ul class="notion-list notion-list-disc notion-block-c89136a6820841b9937bff5af3804dc0"><li>定义格式：变量名称：（元素1，元素2，.....）。</li></ul><ul class="notion-list notion-list-disc notion-block-e5fbc409739a4a2e9318bf8142a9b78b"><li>多数特殊和list一致，不同点在于不可以修改的特性，和定义的格式。（可以修改元素中的列表）</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-76642a86c41a41439f161df6618782dd" data-id="76642a86c41a41439f161df6618782dd"><span><div id="76642a86c41a41439f161df6618782dd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#76642a86c41a41439f161df6618782dd" title="数据容器——字符串"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据容器——字符串</span></span></h4><ul class="notion-list notion-list-disc notion-block-b802e69021b644e3afffdef3965c4d36"><li>只可以存储字符串。</li></ul><ul class="notion-list notion-list-disc notion-block-2acfba4f2da64c1e8b485a467b5c614c"><li>长度任意。</li></ul><ul class="notion-list notion-list-disc notion-block-20d47c294eca41b3812b02e72833dbc4"><li>支持下标索引。</li></ul><ul class="notion-list notion-list-disc notion-block-26d2f16b2bdc439e9ada88fd98860b76"><li>允许重复字符串存在。</li></ul><ul class="notion-list notion-list-disc notion-block-a59bed23e8944801811f0c976895b0d9"><li>不可以修改（增加或删除元素等）。</li></ul><ul class="notion-list notion-list-disc notion-block-7bb76b380906467ba1e13998f2e0ee71"><li>同时支持while和for循环。</li><ul class="notion-list notion-list-disc notion-block-7bb76b380906467ba1e13998f2e0ee71"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-1739cd6433fe41e2916d32194dc6196f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="cddcccf4-1a55-49a7-9cd9-763206dd8289.png" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-2ec7a9f0cc114ebb99eaa9d49b704336" data-id="2ec7a9f0cc114ebb99eaa9d49b704336"><span><div id="2ec7a9f0cc114ebb99eaa9d49b704336" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2ec7a9f0cc114ebb99eaa9d49b704336" title="序列"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">序列</span></span></h4><ul class="notion-list notion-list-disc notion-block-e059662841e4417a91e78a9e76af2b84"><li>序列是内容连续、有序、支持下标索引的一类数据容器。</li></ul><ul class="notion-list notion-list-disc notion-block-c77cf2911cf94a3096c716670505fd15"><li>列表、元组、字符串都可以视为序列。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-0bc5d0633b744ea0a95415b9689d1a4f" data-id="0bc5d0633b744ea0a95415b9689d1a4f"><span><div id="0bc5d0633b744ea0a95415b9689d1a4f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0bc5d0633b744ea0a95415b9689d1a4f" title="序列的切片"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">序列的切片</span></span></h4><ul class="notion-list notion-list-disc notion-block-e15177bf516b49bab59bcd093a50c818"><li>序列切片的格式：序列名[起始:结束:步长]。</li></ul><ul class="notion-list notion-list-disc notion-block-603625fe03a94b96b4d9add21c4f02db"><li>起始可以省略，代表从头开始。</li></ul><ul class="notion-list notion-list-disc notion-block-ed7472df006844aa9d7e7566390c4ed5"><li>结束可以省略，代表到尾结束。</li></ul><ul class="notion-list notion-list-disc notion-block-b9db9eba734f490d948952c54336ee25"><li>结束是一个不含的操作，意思是结束的索引不包含在内。</li></ul><ul class="notion-list notion-list-disc notion-block-80ed88c0df28456fa992f34e9539a5f2"><li>步长可以省略，省略代表步长为1（可以为负数，表示倒序执行）。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-052f2ea4c50a4fb29e2fa09dc4c2e741" data-id="052f2ea4c50a4fb29e2fa09dc4c2e741"><span><div id="052f2ea4c50a4fb29e2fa09dc4c2e741" class="notion-header-anchor"></div><a class="notion-hash-link" href="#052f2ea4c50a4fb29e2fa09dc4c2e741" title="数据容器——集合"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据容器——集合</span></span></h4><ul class="notion-list notion-list-disc notion-block-5a07017307af4d4ab59b67ab5f318d6a"><li>集合可以容纳多个数据。</li></ul><ul class="notion-list notion-list-disc notion-block-a57fe68014054f388428d5d550978e2b"><li>集合可以容纳不同类型的数据（混装）。</li></ul><ul class="notion-list notion-list-disc notion-block-957afd96821c4f0cb15e32b0581c2f5e"><li>集合数据是无序储存的（不支持下标索引）。</li></ul><ul class="notion-list notion-list-disc notion-block-7943f84a67084e4eb3427d3ac7b3c410"><li>集合可以修改（增加或删除元素等）。</li></ul><ul class="notion-list notion-list-disc notion-block-03b6555515a540b59304e3fc0a27b839"><li>集合支持for循环，不支持while循环（因为没有索引）。</li><ul class="notion-list notion-list-disc notion-block-03b6555515a540b59304e3fc0a27b839"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-e19da0b368cf45abb462d82155c8253f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="2ef1a65b-b149-4dac-9a78-844a1c74d0be.png" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-05982d5426cf4f059daeadd3721ca72c" data-id="05982d5426cf4f059daeadd3721ca72c"><span><div id="05982d5426cf4f059daeadd3721ca72c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#05982d5426cf4f059daeadd3721ca72c" title="数据容器——字典（dict）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据容器——字典（dict）</span></span></h4><ul class="notion-list notion-list-disc notion-block-befd8ca6192d42ffbec92f03dc91ab01"><li>定义字典方式：变量名 = { key:balue , key:balue , key:balue }。</li></ul><ul class="notion-list notion-list-disc notion-block-be8fd0d2059b406289351cfc8f9fcb44"><li>字典可以提供基于Key检索Value的场景实现，就像查字典一样。</li></ul><ul class="notion-list notion-list-disc notion-block-b65034c86348458ab9aa04502e4ff455"><li>字典的定义和集合使用同样的大括号，不过存储的元素是一个个的键值对（Key:Value）。</li></ul><ul class="notion-list notion-list-disc notion-block-8227a93210a34742ac5ba96027934971"><li>键值对的Key和Value可以是任意类型（Key不可为字典）。</li></ul><ul class="notion-list notion-list-disc notion-block-8cb54b46921f4fd0bfa735e7b09b7c18"><li>字典内Key不允许重复，重复添加等同于覆盖原有数据。</li></ul><ul class="notion-list notion-list-disc notion-block-dda2bcdd54a343cb9b57ffdebc782ed1"><li>字典不可用下标索引，而是通过key检索Value。</li></ul><ul class="notion-list notion-list-disc notion-block-593e1376ced84a80ae47c33acc8caadb"><li>dict支持for循环，不支持while循环。</li></ul><ul class="notion-list notion-list-disc notion-block-7b4ec786669b43919066b957035418f4"><li>注意新增和更新元素的语法一致，如果Key不存在即新增，如果Key存在即更新（key不可重复）。</li><ul class="notion-list notion-list-disc notion-block-7b4ec786669b43919066b957035418f4"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-5de534c22cba4f8298cbf2395c361c3e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img src="65a51664-9f3e-492b-8ce1-95571bc5499e.png" alt="notion image" loading="lazy" decoding="async"/></div></figure></ul></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-2a6dd7a059ca4879a34f927f4c42d3ee" data-id="2a6dd7a059ca4879a34f927f4c42d3ee"><span><div id="2a6dd7a059ca4879a34f927f4c42d3ee" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2a6dd7a059ca4879a34f927f4c42d3ee" title="函数的传参方式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数的传参方式</span></span></h4><ul class="notion-list notion-list-disc notion-block-c8681fabfdb44bee8d262dbca750aaae"><li>位置参数：根据参数位置来传递参数。</li></ul><ul class="notion-list notion-list-disc notion-block-cdcdd790515c4323b786b933668ce0f3"><li>关键字参数：通过“键=值”形式传递参数，可以不限参数顺序，可以和位置参数混用，位置参数需在前。</li></ul><ul class="notion-list notion-list-disc notion-block-7ae07778a7a3448b84ad7883c2ed4d49"><li>缺省参数：不传递参数值时会使用默认的参数值，但默认值的参数必须定义在最后。</li></ul><ul class="notion-list notion-list-disc notion-block-638c219d6bcc4d089b77786e489571a8"><li>不定长参数：位置不定长：传递以*号标记一个形式参数，以元组的形式接受参数，形式参数一般命名为args。</li></ul><ul class="notion-list notion-list-disc notion-block-f411cf16df214bcd8a0094416cde6cd1"><li>不定长参数：关键字不定长：传递以**号标记一个形式参数，以字典的形式接受参数，形式参数一般命名为kwargs。</li></ul><ul class="notion-list notion-list-disc notion-block-6103675409114ef093a10faabb35bc65"><li>函数本身是可以作为参数传入另一个函数中进行使用的，将函数传入的作用在于传入计算逻辑，而非传入数据。</li></ul><ul class="notion-list notion-list-disc notion-block-c155731650b84f479e0e1ac742b07051"><li>匿名函数使用lambda关键字定义，匿名函数用于临时构建一个函数，只用一次的场景，匿名函数的定义中，函数体只能写一行代码。
匿名函数的定义格式：lambda 传入参数:函数体(一行代码)。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-98a656d66ee7423683250ab75c12310f" data-id="98a656d66ee7423683250ab75c12310f"><span><div id="98a656d66ee7423683250ab75c12310f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#98a656d66ee7423683250ab75c12310f" title="文件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">文件</span></span></h4><ul class="notion-list notion-list-disc notion-block-6bba72c693954abe8138569764f0f81c"><li>编码是一种规则集合，记录了内容和二进制间进行互换的逻辑，编码有很多种，我们最常用的是UTF-8编码。</li></ul><ul class="notion-list notion-list-disc notion-block-28bb765719494940b890305ab772aae2"></ul></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[字面量的含义]]></title>
            <link>https://heliang.fun/article/9e096181-9b80-4f78-9be1-7ac576a83f00</link>
            <guid>https://heliang.fun/article/9e096181-9b80-4f78-9be1-7ac576a83f00</guid>
            <pubDate>Fri, 02 Jul 2021 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-9e0961819b804f789be17ac576a83f00"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-6c51106bde2448978d0c588c71bbdb75" data-id="6c51106bde2448978d0c588c71bbdb75"><span><div id="6c51106bde2448978d0c588c71bbdb75" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6c51106bde2448978d0c588c71bbdb75" title="字面量的含义"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">字面量的含义</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-c4c3336c372b498fa91890f7dfe07e75"><li>字面量：在代码中，被写下来的的固定的值，称之为字面量。被print打印出来的也是字面量。</li></ol><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-c3fb9dc637db44ddbcb085af7bec9dfd" data-id="c3fb9dc637db44ddbcb085af7bec9dfd"><span><div id="c3fb9dc637db44ddbcb085af7bec9dfd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c3fb9dc637db44ddbcb085af7bec9dfd" title="字面量类型的解释"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">字面量类型的解释</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-3c706f9095a7429eba0734a7708e9321"><li>整数 <code class="notion-inline-code">int</code> ：数学里的整数，如1, 10, 200。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-63a92779a38f4dd1bf4508623bbda505"><li>浮点数 <code class="notion-inline-code">float</code> ：数学里的小数，如1.2, 13.14。</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-0e48d062a87d4cf5a36d715c08c014c7"><li>字符串：又称文本，能由任意数量的字符和中英文、数字符号等组成。Python中，被引号包围起来的都是字符串。</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-c72a4ea0f59444208e510f44a4b15b9f"><li>注意：目前的学习只需要用到这三种类型。</li></ol><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-d31c3bec000b4cd4ab290aa5b1551dba"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3d7186a9-38f2-4d2e-9d45-27266a863aa4%2FUntitled.png?table=block&amp;id=d31c3bec-000b-4cd4-ab29-0aa5b1551dba" alt="notion image" loading="lazy" decoding="async"/></div></figure></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[注释的作用]]></title>
            <link>https://heliang.fun/article/7354975d-6c06-475b-a0ff-c5ac20d804e2</link>
            <guid>https://heliang.fun/article/7354975d-6c06-475b-a0ff-c5ac20d804e2</guid>
            <pubDate>Fri, 02 Jul 2021 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-7354975d6c06475ba0ffc5ac20d804e2"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-e74cf9691d964653bf1144b2145e22e4" data-id="e74cf9691d964653bf1144b2145e22e4"><span><div id="e74cf9691d964653bf1144b2145e22e4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e74cf9691d964653bf1144b2145e22e4" title="注释的作用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">注释的作用</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-82c2cf2152014f3e80382cfa72184b76"><li>注释：对程序代码进行解释说明的文字，它不是程序不能被执行，只是让人看懂代码的作用，能够大大增强程序的可读性。</li></ol><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-01282ba003c04a4d8fedb236c186e035" data-id="01282ba003c04a4d8fedb236c186e035"><span><div id="01282ba003c04a4d8fedb236c186e035" class="notion-header-anchor"></div><a class="notion-hash-link" href="#01282ba003c04a4d8fedb236c186e035" title="注释的类型"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">注释的类型</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-85a0878522814bfc97a4a799d6100ed9"><li>单行注释： <code class="notion-inline-code">#</code>井号开头，再输入一个空格，空格右边的内容就是注释的内容。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-03722480c2414b4281391fcb3f3ece74"><li>多行注释：以一对三个引号引起来 <code class="notion-inline-code">&quot;&quot;&quot;  &quot;&quot;&quot;</code> 的内容也是注释，可以换行进行多行注释，一般用于解释整个python代码文件的（一般在文件的开头）类、方法。</li></ol><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-132ad437c6874a729932898a984a7b26" data-id="132ad437c6874a729932898a984a7b26"><span><div id="132ad437c6874a729932898a984a7b26" class="notion-header-anchor"></div><a class="notion-hash-link" href="#132ad437c6874a729932898a984a7b26" title="规范"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">规范</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-422be8c744f7437bb58232ff99afca2b"><li>规范是python官方建议的要求，不强制，不遵守也不影响程序执行。但官方和大厂的代码都会遵守规范，所以遵守规范也会让我们的代码更高级。（就像上面说到的井号和注释内容之间要输入一个空格这就是一个规范）</li></ol></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[变量]]></title>
            <link>https://heliang.fun/article/8f054e79-b023-4d6a-b608-2788d4fbfd70</link>
            <guid>https://heliang.fun/article/8f054e79-b023-4d6a-b608-2788d4fbfd70</guid>
            <pubDate>Fri, 02 Jul 2021 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-8f054e79b0234d6ab6082788d4fbfd70"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1788dcd2feda49efbc093539421d9a5a" data-id="1788dcd2feda49efbc093539421d9a5a"><span><div id="1788dcd2feda49efbc093539421d9a5a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1788dcd2feda49efbc093539421d9a5a" title="变量的作用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">变量的作用</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-f0a3997a0fbc4371b6fff8519fc516e1"><li>变量：在程序运行时记录数据用的，能储存计算结果或能表示值得抽象概念。</li></ol><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-8f950b3b7b844a96bbcced30cd811166" data-id="8f950b3b7b844a96bbcced30cd811166"><span><div id="8f950b3b7b844a96bbcced30cd811166" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8f950b3b7b844a96bbcced30cd811166" title="变量的格式含义"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">变量的格式含义</span></span></h2><div class="notion-text notion-block-c1ee0640acb6455c82b8247e59041496">变量定义的格式：变量名称 = 变量的值</div><div class="notion-text notion-block-83c1c29d69004f67b4768623b0d32593">变量名称：每个变量都有自己的名称，称之为变量名，也是变量本身。</div><div class="notion-text notion-block-8361e171d62b465e99b8f47a36b98a61">变量的值：每个变量都有自己存储的值（内容），称之为变量值。</div><div class="notion-text notion-block-ba3baa13bba94b2982e48213a5402ada">=：等号是赋值的意思，表示把右边的值赋予给左边的变量。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-2f37f40feb764437be0804911dcc87d8" data-id="2f37f40feb764437be0804911dcc87d8"><span><div id="2f37f40feb764437be0804911dcc87d8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2f37f40feb764437be0804911dcc87d8" title="print打印变量"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">print打印变量</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-7ebd7dc8e8fb4bdea4be93b245eb2769"><li>print可以显示多个内容：print（内容1，内容2，……，内容n）要用逗号来分隔开。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-edf48566d209430391c5a8bda4b6126e"><li>快捷键 ctrl+D 复制粘贴代码到下一行。</li></ol><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-f0f39191cf254330a240710d37284a5a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fbf0ab43c-8fcd-4848-8429-6a3b0aac3e17%2FUntitled.png?table=block&amp;id=f0f39191-cf25-4330-a240-710d37284a5a" alt="notion image" loading="lazy" decoding="async"/></div></figure></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[数据类型]]></title>
            <link>https://heliang.fun/article/eb6e1ec5-109f-4cfe-b015-83d44d3f786b</link>
            <guid>https://heliang.fun/article/eb6e1ec5-109f-4cfe-b015-83d44d3f786b</guid>
            <pubDate>Fri, 02 Jul 2021 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-eb6e1ec5109f4cfeb01583d44d3f786b"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-f3c27ed253d24f54b1512ccf64488f81" data-id="f3c27ed253d24f54b1512ccf64488f81"><span><div id="f3c27ed253d24f54b1512ccf64488f81" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f3c27ed253d24f54b1512ccf64488f81" title="type函数语句"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">type函数语句</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-4812cc6a15644bf3886a9a81f413aeae"><li>语法：type（被查看类型的数据）</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-ad8438c3538448beae6453a3b518dfc9"><li>我们可以通过type（）这个格式来得到数据的类型。</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-8e3936a663684996a2c4c4d493ab2014"><li>在变量中也能够存储类型的信息（储存type（）语句的执行结果）。</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-83d77387d2ff4d119e4ff454b5476e57"><li>注意：变量没有类型，但它储存的数据有类型。举例：字符串变量这句话的意思是，变量里面储存的数据类型是字符串。</li></ol><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-90d28f1c25594f9e88cc67d6e7ecdd84"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5c78bbe9-07aa-458f-a4fe-022c1be948b6%2FUntitled.png?table=block&amp;id=90d28f1c-2559-4f9e-88cc-67d6e7ecdd84" alt="notion image" loading="lazy" decoding="async"/></div></figure></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[定义类型的装换]]></title>
            <link>https://heliang.fun/article/cba9f445-1d18-463f-a93d-df81d7a35a67</link>
            <guid>https://heliang.fun/article/cba9f445-1d18-463f-a93d-df81d7a35a67</guid>
            <pubDate>Fri, 02 Jul 2021 00:00:00 GMT</pubDate>
            <description><![CDATA[仅供列表展示、文章无内容]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-cba9f4451d18463fa93ddf81d7a35a67"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-db413857894c4fb9bcff7d7fe927fb21" data-id="db413857894c4fb9bcff7d7fe927fb21"><span><div id="db413857894c4fb9bcff7d7fe927fb21" class="notion-header-anchor"></div><a class="notion-hash-link" href="#db413857894c4fb9bcff7d7fe927fb21" title="定义类型的转换"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">定义类型的转换</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-109402202d7d48fb901f2fedf777f195"><li>浮点数（float）转换成整数（int）会丢失小数部分。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-59309d1c1e784d3398ed9bb46fa3ebbf"><li>整数（int）转换成浮点数（float）会多个小数点零。</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-39700e0986fc48a78cbe534191c8f88e"><li>字符串（str）转换为整数（int）要求字符串的内容是整数，否则代码错误。</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-aaabf0dccbbe4c739b1c75b679eeee65"><li>字符串（str）可以将任何类型转换成字符串。</li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-176ee489b041475ebf7024e7f9c65be7"><li>注意：从文件中读的数字，默认是字符串，需要转换成数字类型。</li></ol><div class="notion-blank notion-block-66e69039bc53476d8eaf129bc5011f32"> </div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>