<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="https://peda.net/:static/539/atom.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>22. lokakuuta 2025</title>
<id>https://peda.net/id/21fb1880ae9</id>
<updated>2025-10-21T18:46:39+03:00</updated>
<link href="https://peda.net/id/21fb1880ae9:atom" rel="self" />
<link href="https://peda.net/orivesi/perusopetus/yhteiskoulu/oppiaineet/tietoteknikka/tvt-ja-ohjelmointikurssi-25-26/22.-lokakuuta-2025#top" rel="alternate" />
<logo>https://peda.net/:static/539/peda.net.logo.bg.svg</logo>
<rights type="html">&lt;div class=&quot;license&quot;&gt;Tämän sivun lisenssi &lt;a rel=&quot;license&quot; href=&quot;https://peda.net/info&quot;&gt;Peda.net-yleislisenssi&lt;/a&gt;&lt;/div&gt;&#10;</rights>

<entry>
<title>Vertaileminen ohjelmoinnissa (ei vain Pythonissa)</title>
<id>https://peda.net/id/c8eb6302ae9</id>
<updated>2025-10-21T18:56:44+03:00</updated>
<link href="https://peda.net/orivesi/perusopetus/yhteiskoulu/oppiaineet/tietoteknikka/tvt-ja-ohjelmointikurssi-25-26/22.-lokakuuta-2025/vertaileminen#top" />
<content type="html">&lt;h2&gt;&lt;!--filtered attribute: data-start=&quot;190&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;229&quot;--&gt;🔍 1. Mitä tarkoittaa vertaileminen?&lt;/h2&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;231&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;351&quot;--&gt;Kun vertaillaan arvoja, halutaan tietää &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;271&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;298&quot;--&gt;onko jokin totta vai ei&lt;/strong&gt;.&lt;br/&gt;&#10;&lt;!--filtered attribute: data-start=&quot;299&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;302&quot;--&gt;Pythonissa tätä tehdään usein &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;332&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;350&quot;--&gt;if-rakenteessa&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;353&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;365&quot;--&gt;Esimerkiksi:&lt;/p&gt;&#10;&lt;div class=&quot;contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary&quot;&gt;&#10;&lt;div class=&quot;sticky top-9&quot;&gt;&#10;&lt;div class=&quot;absolute end-0 bottom-0 flex h-9 items-center pe-2&quot;&gt;&#10;&lt;div class=&quot;bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs&quot;&gt; &lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class=&quot;overflow-y-auto p-4&quot; dir=&quot;ltr&quot;&gt;&lt;code class=&quot;whitespace-pre! language-python&quot;&gt;&lt;span&gt;ikä = &lt;span class=&quot;hljs-number&quot;&gt;15&lt;/span&gt;&#10;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; ikä &amp;gt;= &lt;span class=&quot;hljs-number&quot;&gt;13&lt;/span&gt;:&#10;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Olet teini-ikäinen!&amp;quot;&lt;/span&gt;)&#10;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;437&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;574&quot;--&gt;➡️ Tässä ohjelma &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;454&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;464&quot;--&gt;vertaa&lt;/strong&gt; muuttujaa &lt;code&gt;&lt;!--filtered attribute: data-start=&quot;475&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;480&quot;--&gt;ikä&lt;/code&gt; ja lukua &lt;code&gt;&lt;!--filtered attribute: data-start=&quot;490&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;494&quot;--&gt;13&lt;/code&gt;.&lt;br/&gt;&#10;&lt;!--filtered attribute: data-start=&quot;495&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;498&quot;--&gt;Koska 15 on suurempi kuin 13, ehto on &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;536&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;544&quot;--&gt;tosi&lt;/strong&gt;, ja ohjelma tulostaa tekstin.&lt;/p&gt;&#10;&lt;hr&gt;&lt;/hr&gt;&lt;!--filtered attribute: data-start=&quot;576&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;579&quot;--&gt;&#10;&lt;h2&gt;&lt;!--filtered attribute: data-start=&quot;581&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;604&quot;--&gt;⚙️ 2. Vertailumerkit&lt;/h2&gt;&#10;&lt;div class=&quot;_tableContainer_1rjym_1&quot;&gt;&#10;&lt;div class=&quot;group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse&quot;&gt;&#10;&lt;table class=&quot;w-fit min-w-(--thread-content-width)&quot;&gt;&lt;!--filtered attribute: data-start=&quot;606&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;993&quot;--&gt;&#10;&lt;thead&gt;&lt;!--filtered attribute: data-start=&quot;606&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;648&quot;--&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;606&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;648&quot;--&gt;&#10;&lt;th&gt;&lt;!--filtered attribute: data-start=&quot;606&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;615&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;Merkki&lt;/th&gt;&#10;&lt;th&gt;&lt;!--filtered attribute: data-start=&quot;615&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;627&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;Tarkoitus&lt;/th&gt;&#10;&lt;th&gt;&lt;!--filtered attribute: data-start=&quot;627&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;639&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;Esimerkki&lt;/th&gt;&#10;&lt;th&gt;&lt;!--filtered attribute: data-start=&quot;639&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;648&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;Tulos&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&lt;!--filtered attribute: data-start=&quot;695&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;993&quot;--&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;695&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;742&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;695&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;702&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;697&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;701&quot;--&gt;==&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;702&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;723&quot;--&gt;on yhtä suuri kuin&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;723&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;734&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;725&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;733&quot;--&gt;5 == 5&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;734&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;742&quot;--&gt;True&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;743&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;794&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;743&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;750&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;745&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;749&quot;--&gt;!=&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;750&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;775&quot;--&gt;ei ole yhtä suuri kuin&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;775&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;786&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;777&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;785&quot;--&gt;5 != 3&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;786&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;794&quot;--&gt;True&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;795&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;836&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;795&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;801&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;797&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;800&quot;--&gt;&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;801&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;817&quot;--&gt;suurempi kuin&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;817&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;828&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;819&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;827&quot;--&gt;10 &amp;gt; 3&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;828&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;836&quot;--&gt;True&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;837&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;877&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;837&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;843&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;839&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;842&quot;--&gt;&amp;lt;&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;843&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;859&quot;--&gt;pienempi kuin&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;859&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;869&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;861&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;868&quot;--&gt;2 &amp;lt; 5&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;869&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;877&quot;--&gt;True&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;878&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;935&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;878&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;885&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;880&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;884&quot;--&gt;&amp;gt;=&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;885&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;916&quot;--&gt;suurempi tai yhtä suuri kuin&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;916&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;927&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;918&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;926&quot;--&gt;5 &amp;gt;= 5&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;927&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;935&quot;--&gt;True&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;936&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;993&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;936&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;943&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;938&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;942&quot;--&gt;&amp;lt;=&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;943&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;974&quot;--&gt;pienempi tai yhtä suuri kuin&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;974&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;985&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;976&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;984&quot;--&gt;3 &amp;lt;= 4&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;985&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;993&quot;--&gt;True&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;hr&gt;&lt;/hr&gt;&lt;!--filtered attribute: data-start=&quot;995&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;998&quot;--&gt;&#10;&lt;h2&gt;&lt;!--filtered attribute: data-start=&quot;1000&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1030&quot;--&gt;🔢 3. int ja float vertailu&lt;/h2&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;1032&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1151&quot;--&gt;&lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;1032&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1055&quot;--&gt;Kokonaisluvut (int)&lt;/strong&gt; ja &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;1059&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1085&quot;--&gt;desimaaliluvut (float)&lt;/strong&gt; voidaan vertailla keskenään,&lt;br/&gt;&#10;&lt;!--filtered attribute: data-start=&quot;1114&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1117&quot;--&gt;koska molemmat ovat &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;1137&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1150&quot;--&gt;numeroita&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;div class=&quot;contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary&quot;&gt;&#10;&lt;div class=&quot;sticky top-9&quot;&gt;&#10;&lt;div class=&quot;absolute end-0 bottom-0 flex h-9 items-center pe-2&quot;&gt;&#10;&lt;div class=&quot;bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs&quot;&gt; &lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class=&quot;overflow-y-auto p-4&quot; dir=&quot;ltr&quot;&gt;&lt;code class=&quot;whitespace-pre! language-python&quot;&gt;&lt;span&gt;a = &lt;span class=&quot;hljs-number&quot;&gt;5&lt;/span&gt;&#10;b = &lt;span class=&quot;hljs-number&quot;&gt;5.0&lt;/span&gt;&#10;&#10;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; a == b:&#10;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Luvut ovat samat!&amp;quot;&lt;/span&gt;)&#10;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;1225&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1322&quot;--&gt;✅ Tulostaa: &lt;code&gt;&lt;!--filtered attribute: data-start=&quot;1237&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1256&quot;--&gt;Luvut ovat samat!&lt;/code&gt;&lt;br/&gt;&#10;&lt;!--filtered attribute: data-start=&quot;1256&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1259&quot;--&gt;(selitys: 5 ja 5.0 ovat arvoltaan samat, vaikka tyypit eroavat)&lt;/p&gt;&#10;&lt;hr&gt;&lt;/hr&gt;&lt;!--filtered attribute: data-start=&quot;1324&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1327&quot;--&gt;&#10;&lt;h2&gt;&lt;!--filtered attribute: data-start=&quot;1329&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1359&quot;--&gt;📝 4. str (teksti) vertailu&lt;/h2&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;1361&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1409&quot;--&gt;Tekstejä (&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;1371&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1376&quot;--&gt;str&lt;/code&gt;) verrataan myös &lt;code&gt;&lt;!--filtered attribute: data-start=&quot;1393&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1397&quot;--&gt;==&lt;/code&gt;-merkillä.&lt;/p&gt;&#10;&lt;div class=&quot;contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary&quot;&gt;&#10;&lt;div class=&quot;sticky top-9&quot;&gt;&#10;&lt;div class=&quot;absolute end-0 bottom-0 flex h-9 items-center pe-2&quot;&gt;&#10;&lt;div class=&quot;bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs&quot;&gt; &lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class=&quot;overflow-y-auto p-4&quot; dir=&quot;ltr&quot;&gt;&lt;code class=&quot;whitespace-pre! language-python&quot;&gt;&lt;span&gt;nimi = &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Ada&amp;quot;&lt;/span&gt;&#10;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; nimi == &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Ada&amp;quot;&lt;/span&gt;:&#10;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Hei Ada!&amp;quot;&lt;/span&gt;)&#10;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;1479&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1501&quot;--&gt;✅ Tulostaa: &lt;code&gt;&lt;!--filtered attribute: data-start=&quot;1491&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1501&quot;--&gt;Hei Ada!&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;1503&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1580&quot;--&gt;⚠️ &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;1506&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1518&quot;--&gt;Tärkeää:&lt;/strong&gt; Tekstivertailussa isot ja pienet kirjaimet &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;1562&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1579&quot;--&gt;ovat eri asia&lt;/strong&gt;:&lt;/p&gt;&#10;&lt;div class=&quot;contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary&quot;&gt;&#10;&lt;div class=&quot;sticky top-9&quot;&gt;&#10;&lt;div class=&quot;absolute end-0 bottom-0 flex h-9 items-center pe-2&quot;&gt;&#10;&lt;div class=&quot;bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs&quot;&gt; &lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class=&quot;overflow-y-auto p-4&quot; dir=&quot;ltr&quot;&gt;&lt;code class=&quot;whitespace-pre! language-python&quot;&gt;&lt;span&gt;nimi = &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;ada&amp;quot;&lt;/span&gt;&#10;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; nimi == &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Ada&amp;quot;&lt;/span&gt;:&#10;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Hei Ada!&amp;quot;&lt;/span&gt;)   &lt;span class=&quot;hljs-comment&quot;&gt;# Tämä ei tulostu, koska kirjaimet eroavat&lt;/span&gt;&#10;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;hr&gt;&lt;/hr&gt;&lt;!--filtered attribute: data-start=&quot;1694&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1697&quot;--&gt;&#10;&lt;h2&gt;&lt;!--filtered attribute: data-start=&quot;1699&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1740&quot;--&gt;🚫 5. Älä vertaa eri tyyppejä sekaisin&lt;/h2&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;1742&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1810&quot;--&gt;Jos yrität verrata &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;1761&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1781&quot;--&gt;tekstiä ja lukua&lt;/strong&gt;, Python ei tiedä mitä tehdä.&lt;/p&gt;&#10;&lt;div class=&quot;contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary&quot;&gt;&#10;&lt;div class=&quot;sticky top-9&quot;&gt;&#10;&lt;div class=&quot;absolute end-0 bottom-0 flex h-9 items-center pe-2&quot;&gt;&#10;&lt;div class=&quot;bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs&quot;&gt; &lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class=&quot;overflow-y-auto p-4&quot; dir=&quot;ltr&quot;&gt;&lt;code class=&quot;whitespace-pre! language-python&quot;&gt;&lt;span&gt;ikä = &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;15&amp;quot;&lt;/span&gt;      &lt;span class=&quot;hljs-comment&quot;&gt;# tämä on teksti&lt;/span&gt;&#10;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; ikä &amp;gt; &lt;span class=&quot;hljs-number&quot;&gt;10&lt;/span&gt;:    &lt;span class=&quot;hljs-comment&quot;&gt;# virhe!&lt;/span&gt;&#10;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Olet yli 10&amp;quot;&lt;/span&gt;)&#10;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;1910&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1981&quot;--&gt;❌ Tämä antaa virheilmoituksen, koska &lt;code&gt;&lt;!--filtered attribute: data-start=&quot;1947&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1953&quot;--&gt;&amp;quot;15&amp;quot;&lt;/code&gt; on &lt;strong&gt;&lt;!--filtered attribute: data-start=&quot;1957&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1967&quot;--&gt;teksti&lt;/strong&gt;, ei numero.&lt;/p&gt;&#10;&lt;p&gt;&lt;!--filtered attribute: data-start=&quot;1983&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;1997&quot;--&gt;✅ Korjaa näin:&lt;/p&gt;&#10;&lt;div class=&quot;contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary&quot;&gt;&#10;&lt;div class=&quot;sticky top-9&quot;&gt;&#10;&lt;div class=&quot;absolute end-0 bottom-0 flex h-9 items-center pe-2&quot;&gt;&#10;&lt;div class=&quot;bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs&quot;&gt; &lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class=&quot;overflow-y-auto p-4&quot; dir=&quot;ltr&quot;&gt;&lt;code class=&quot;whitespace-pre! language-python&quot;&gt;&lt;span&gt;ikä = &lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt;(&lt;span class=&quot;hljs-built_in&quot;&gt;input&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Kuinka vanha olet? &amp;quot;&lt;/span&gt;))&#10;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; ikä &amp;gt; &lt;span class=&quot;hljs-number&quot;&gt;10&lt;/span&gt;:&#10;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Olet yli 10-vuotias!&amp;quot;&lt;/span&gt;)&#10;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;hr&gt;&lt;/hr&gt;&lt;!--filtered attribute: data-start=&quot;2100&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2103&quot;--&gt;&#10;&lt;h2&gt;&lt;!--filtered attribute: data-start=&quot;2105&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2124&quot;--&gt;🧩 6. Yhteenveto&lt;/h2&gt;&#10;&lt;div class=&quot;_tableContainer_1rjym_1&quot;&gt;&#10;&lt;div class=&quot;group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse&quot;&gt;&#10;&lt;table class=&quot;w-fit min-w-(--thread-content-width)&quot;&gt;&lt;!--filtered attribute: data-start=&quot;2126&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2520&quot;--&gt;&#10;&lt;thead&gt;&lt;!--filtered attribute: data-start=&quot;2126&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2183&quot;--&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;2126&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2183&quot;--&gt;&#10;&lt;th&gt;&lt;!--filtered attribute: data-start=&quot;2126&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2140&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;Tietotyyppi&lt;/th&gt;&#10;&lt;th&gt;&lt;!--filtered attribute: data-start=&quot;2140&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2152&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;Esimerkki&lt;/th&gt;&#10;&lt;th&gt;&lt;!--filtered attribute: data-start=&quot;2152&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2173&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;Vertailu onnistuu?&lt;/th&gt;&#10;&lt;th&gt;&lt;!--filtered attribute: data-start=&quot;2173&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2183&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;Huomio&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&lt;!--filtered attribute: data-start=&quot;2243&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2520&quot;--&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;2243&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2292&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;2243&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2256&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;int vs int&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2256&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2267&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;2258&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2266&quot;--&gt;5 == 5&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2267&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2271&quot;--&gt;✅&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2271&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2292&quot;--&gt;Normaali vertailu&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;2293&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2349&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;2293&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2310&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;float vs float&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2310&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2324&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;2312&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2323&quot;--&gt;3.5 &amp;lt; 4.0&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2324&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2328&quot;--&gt;✅&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2328&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2349&quot;--&gt;Normaali vertailu&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;2350&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2407&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;2350&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2365&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;int vs float&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2365&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2378&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;2367&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2377&quot;--&gt;2 == 2.0&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2378&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2382&quot;--&gt;✅&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2382&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2407&quot;--&gt;Arvo sama, tyyppi eri&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;2408&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2461&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;2408&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2421&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;str vs str&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2421&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2436&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;2423&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2435&quot;--&gt;&amp;quot;a&amp;quot; == &amp;quot;A&amp;quot;&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2436&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2440&quot;--&gt;✅&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2440&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2461&quot;--&gt;Huom. kirjainkoko&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&lt;!--filtered attribute: data-start=&quot;2462&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2520&quot;--&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-start=&quot;2462&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2481&quot;--&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;str vs int/float&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2481&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2494&quot;--&gt;&lt;code&gt;&lt;!--filtered attribute: data-start=&quot;2483&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2493&quot;--&gt;&amp;quot;5&amp;quot; == 5&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2494&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2498&quot;--&gt;❌&lt;/td&gt;&#10;&lt;td&gt;&lt;!--filtered attribute: data-col-size=&quot;sm&quot;--&gt;&lt;!--filtered attribute: data-start=&quot;2498&quot;--&gt;&lt;!--filtered attribute: data-end=&quot;2520&quot;--&gt;Eri tyyppi, virhe!&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;h3&gt;Tavoitteet oppitunnille kuten aiemminkin&lt;/h3&gt;&#10;&lt;span&gt;Jatka Python-kielen opiskelua systemaattisesti: käy läpi kirjan tehtäviä. Kun saat tehtyä Kuutio 7:n harjoitukset, jatka Kuutio 8:n harjoituksiin.&lt;/span&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span&gt;Käytä tarvitessasi tekoälöyä (Copilot, ChatGPT,...) apuna tehtävän tekemiseen ja tai sen muuttamiseen. &lt;/span&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span&gt;Muista, että tavoiteena on nyt, että ymmärrät jokaista pilkkua myöten, mitä koodissa tehdään. Tämä ei ole vibe-codingia!&lt;/span&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span&gt;Pidä paperista kirjanpitoa harjoittelustasi. Se auttaa pitämään työskentelyä systemaattisena (ja sen perusteella arvioidaan työskentelyäsi).&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Ada_Lovelace&quot; rel=&quot;noopener nofollow ugc&quot; target=&quot;_blank&quot;&gt;Kuka on ollut Ada - koodareittein kulttihenkilö?!&lt;/a&gt;&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;</content>
<published>2025-10-21T18:51:19+03:00</published>
</entry>


</feed>