<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="lt">
	<id>https://wiki.angis.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mantas</id>
	<title>wiki.angis.net - Naudotojo indėlis [lt]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.angis.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mantas"/>
	<link rel="alternate" type="text/html" href="https://wiki.angis.net/w/Specialus:Ind%C4%97lis/Mantas"/>
	<updated>2026-05-03T09:13:06Z</updated>
	<subtitle>Naudotojo indėlis</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vadov%C4%97lis/Print_version&amp;diff=3946</id>
		<title>Vadovėlis/Print version</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vadov%C4%97lis/Print_version&amp;diff=3946"/>
		<updated>2022-05-19T10:57:23Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Print version notice}}&lt;br /&gt;
{{Print version cover}}&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOEDITSECTION__&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= 1. Įžanga =&lt;br /&gt;
{{:Vadovėlis/Įžanga}}&lt;br /&gt;
----&lt;br /&gt;
= 2. Įvadas =&lt;br /&gt;
{{:Vadovėlis/Intro}}&lt;br /&gt;
----&lt;br /&gt;
= 3. Labas, Pasauli =&lt;br /&gt;
{{:Vadovėlis/Labas, Pasauli}}&lt;br /&gt;
----&lt;br /&gt;
=4. Kas čia eina?=&lt;br /&gt;
{{:Vadovėlis/Kas čia eina?}}&lt;br /&gt;
----&lt;br /&gt;
=5. Suskaičiuoti iki 10 =&lt;br /&gt;
{{:Vadovėlis/Suskaičiuoti iki 10}}&lt;br /&gt;
----&lt;br /&gt;
=6. Pasirinkimai =&lt;br /&gt;
{{:Vadovėlis/Pasirinkimai}}&lt;br /&gt;
----&lt;br /&gt;
= 7. Derinimas =&lt;br /&gt;
{{:Vadovėlis/Derinimas}}&lt;br /&gt;
----&lt;br /&gt;
= 8. Funkcijų apibrėžimas =&lt;br /&gt;
{{:Vadovėlis/Funkcijų apibrėžimas}}&lt;br /&gt;
----&lt;br /&gt;
= 9. Rekursinės funkcijos =&lt;br /&gt;
{{:Vadovėlis/Rekursinės funkcijos}}&lt;br /&gt;
----&lt;br /&gt;
= 10. Sąrašai =&lt;br /&gt;
{{:Vadovėlis/Sąrašai}}&lt;br /&gt;
----&lt;br /&gt;
= 11. Ciklai For =&lt;br /&gt;
{{:Vadovėlis/Ciklai For}}&lt;br /&gt;
----&lt;br /&gt;
= 12. Loginiai reiškiniai =&lt;br /&gt;
{{:Vadovėlis/Loginiai reiškiniai}}&lt;br /&gt;
----&lt;br /&gt;
= 13. Žodynai =&lt;br /&gt;
{{:Vadovėlis/Žodynai}}&lt;br /&gt;
----&lt;br /&gt;
= 14. Modulių naudojimas =&lt;br /&gt;
{{:Vadovėlis/Modulių naudojimas}}&lt;br /&gt;
----&lt;br /&gt;
= 15. Daugiau apie sąrašus =&lt;br /&gt;
{{:Vadovėlis/Daugiau apie sąrašus}}&lt;br /&gt;
----&lt;br /&gt;
= 16. Daugiau apie tekstines eilutes =&lt;br /&gt;
{{:Vadovėlis/Daugiau apie tekstines eilutes}}&lt;br /&gt;
----&lt;br /&gt;
= 17. Failų tvarkymas =&lt;br /&gt;
{{:Vadovėlis/Failų tvarkymas}}&lt;br /&gt;
----&lt;br /&gt;
= 18. Siekiant tobulumo =&lt;br /&gt;
{{:Vadovėlis/Siekiant tobulumo}}&lt;br /&gt;
----&lt;br /&gt;
= 19. Pabaiga =&lt;br /&gt;
{{:Vadovėlis/Pabaiga}}&lt;br /&gt;
----&lt;br /&gt;
= 20. D.U.K. =&lt;br /&gt;
{{:Vadovėlis/D.U.K.}}&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vadov%C4%97lis/Print_version&amp;diff=3945</id>
		<title>Vadovėlis/Print version</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vadov%C4%97lis/Print_version&amp;diff=3945"/>
		<updated>2022-05-19T10:47:06Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Print version notice}}&lt;br /&gt;
{{Print version cover}}&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOEDITSECTION__&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= 1. Front matter =&lt;br /&gt;
{{:Vadovėlis/Įžanga}}&lt;br /&gt;
----&lt;br /&gt;
= 2. Intro =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Intro}}&lt;br /&gt;
----&lt;br /&gt;
= 3. Hello, World =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Hello, World}}&lt;br /&gt;
----&lt;br /&gt;
=4. Who Goes There?=&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Who Goes There?}}&lt;br /&gt;
----&lt;br /&gt;
=5. Count to 10=&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Count to 10}}&lt;br /&gt;
----&lt;br /&gt;
=6. Decisions =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Decisions}}&lt;br /&gt;
----&lt;br /&gt;
= 7. Debugging =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Debugging}}&lt;br /&gt;
----&lt;br /&gt;
= 8. Defining Functions =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Defining Functions}}&lt;br /&gt;
----&lt;br /&gt;
= 9. Advanced Functions Example =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Advanced Functions Example}}&lt;br /&gt;
----&lt;br /&gt;
= 10. Lists =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Lists}}&lt;br /&gt;
----&lt;br /&gt;
= 11. For Loops =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/For Loops}}&lt;br /&gt;
----&lt;br /&gt;
= 12. Boolean Expressions =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Boolean Expressions}}&lt;br /&gt;
----&lt;br /&gt;
= 13. Dictionaries =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Dictionaries}}&lt;br /&gt;
----&lt;br /&gt;
= 14. Using Modules =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Using Modules}}&lt;br /&gt;
----&lt;br /&gt;
= 15. More on Lists =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/More on Lists}}&lt;br /&gt;
----&lt;br /&gt;
= 16. Revenge of the Strings =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Revenge of the Strings}}&lt;br /&gt;
----&lt;br /&gt;
= 17. File IO =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/File IO}}&lt;br /&gt;
----&lt;br /&gt;
= 18. Dealing with the imperfect =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/Dealing with the imperfect}}&lt;br /&gt;
----&lt;br /&gt;
= 19. The End =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/The End}}&lt;br /&gt;
----&lt;br /&gt;
= 20. FAQ =&lt;br /&gt;
{{:Non-Programmer's Tutorial for Python 3/FAQ}}&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Suskai%C4%8Diuoti_iki_10&amp;diff=3753</id>
		<title>Python Vadovėlis/Suskaičiuoti iki 10</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Suskai%C4%8Diuoti_iki_10&amp;diff=3753"/>
		<updated>2022-01-07T14:18:02Z</updated>

		<summary type="html">&lt;p&gt;Mantas: /* Ciklai kol (While loops) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Ciklai kol (While loops) ===&lt;br /&gt;
Šiame skyriuje susipažinsi su ciklu &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; - lietuviškas atitikmuo būtų ciklas kol. Kaip jau sužinojai praeitame skyriuje, kompiuteris įprastai programą pradeda skaityti ir vykdyti nuo pirmos eilutės ir taip eilutė po eilutės keliauja žemyn per visas duoto kodo eilutes. Tačiau ciklas &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; šią tvarką pakeičia ir dėl to kompiuteris priėjęs šią kodo vietą eilutes skaito iki galo, pagal šio ciklo nustatytą tvarką. Štai čia yra programos su ciklo &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; pavyzdžiu:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 0            # PIRMA, nustatome pradinio kintamojo a reikšmę 0 (nuliui).&lt;br /&gt;
while a &amp;lt; 10:    # Kol kintamojo a vertė yra mažesnė nei 10, programa atlieka šiuos veiksmus:&lt;br /&gt;
    a = a + 1    # Padidina kintamojo a reikšmę 1 (vienu), visai taip kaip nurodyta: a = a + 1! &lt;br /&gt;
    print(a)     # Tuomet nurodome, kad spausdintų. Viskas tam, kad pamatytumėte, kokia yra dabartinė kintamojo a vertė.&lt;br /&gt;
                 # Ir visą šitą ciklą programa vykdo tol, kol kintamojo a reikšmė bus lygi 9!? Žr. Pastabą.&lt;br /&gt;
                 &lt;br /&gt;
                 # PASTABA:&lt;br /&gt;
                 # Kintamojo a vertė padidės 1&lt;br /&gt;
                 # su kiekvienu pakartojimu ar ciklu, kol pasieks nustatytą sąlygą ir sustos.&lt;br /&gt;
                 # pvz. a = 1, tada a = 2, tada a = 3 ir t.t., kol a bus lygus 9 (a = 9), tada...&lt;br /&gt;
                 # kodas baigs pridėjinėti po 1 prie a, nes taps lygus 10 (a = 10) kaip ir numatyta mūsų parašytoje sąlygoje. &lt;br /&gt;
                 # O kai mūsų nurodyta sąlyga yra patenkinama, programa atspausdina rezultatą.&lt;br /&gt;
                 #              --&lt;br /&gt;
                 # While a &amp;lt; 10: |&lt;br /&gt;
                 #     a = a + 1 |&amp;lt;--[ Ciklo Kol sąlygos blokas ]&lt;br /&gt;
                 #     print (a) |&lt;br /&gt;
                 #              --&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Na, o jeigu paleidžiame programą, tai turime štai tokį įdomų rezultatą: &lt;br /&gt;
&lt;br /&gt;
 1&lt;br /&gt;
 2&lt;br /&gt;
 3&lt;br /&gt;
 4&lt;br /&gt;
 5&lt;br /&gt;
 6&lt;br /&gt;
 7&lt;br /&gt;
 8&lt;br /&gt;
 9&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
(Tikriausiai iki šios pamokos net nesusimąstei, kad kompiuterį gali paversti pigiu skaičiuotuvu...)&lt;br /&gt;
&lt;br /&gt;
Na, o dabar pasiaiškinkime kaip veikia ši programa. Pirmiausia kompiuteris mato eilutę &amp;lt;code&amp;gt;a = 0&amp;lt;/code&amp;gt; ir nustato &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; reikšmę lygią nuliui. Tada programa mato sąlygą &amp;lt;code&amp;gt;while a &amp;lt; 10:&amp;lt;/code&amp;gt;, todėl kompiuteris patikrina, ar &amp;lt;code&amp;gt;a &amp;lt; 10&amp;lt;/code&amp;gt;. Kompiuteriui pirmą kartą matant šį teiginį, &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; yra lygus 0, ir akivaizdu, kad turima reikšmė yra mažesnė nei. Kitaip tariant, kol &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; yra mažesnis skaičius nei dešimt, tol kompiuteris tikrins teiginį ir kartos jį (t.y. pridėjinės po 1), kol &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; bus lygus dešimčiai. Kai pasieks šią nustatytą reikšmę programa nustos skaityti eilutes ir prie kitų kodo eilučių. Kadangi šiame kode daugiau nieko nėra, tai programa sustoja.&lt;br /&gt;
&lt;br /&gt;
ĮSIDĖMĖK: Nepamiršk parašyti dvitaškio &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; eilutės pabaigoje, tik taip kompiuteris supras, kad čia yra teiginys!&lt;br /&gt;
&lt;br /&gt;
Kitas ciklo &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; pavyzdys:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 1&lt;br /&gt;
s = 0&lt;br /&gt;
print('Įvesk skaičius, kuriuos nori pridėti prie sumos.')&lt;br /&gt;
print('Norint išeiti, įvesk 0.')&lt;br /&gt;
while a != 0:                           &lt;br /&gt;
    print('Dabartinė suma:', s)            &lt;br /&gt;
    a = float(input('Skaičius? '))        &lt;br /&gt;
    s = s + a                            &lt;br /&gt;
print('Galutinė suma =', s)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Galimas programos scenarijus: &lt;br /&gt;
&lt;br /&gt;
 Įvesk skaičius, kuriuos nori pridėti prie sumos.&lt;br /&gt;
 Norint išeiti, įveskite 0.&lt;br /&gt;
 Dabartinė suma: 0&lt;br /&gt;
 Skaičius? '''200'''&lt;br /&gt;
 Dabartinė suma: 200.0&lt;br /&gt;
 Skaičius? '''-15.25'''&lt;br /&gt;
 Dabartinė suma: 184.75&lt;br /&gt;
 Skaičius? '''-151.85'''&lt;br /&gt;
 Dabartinė suma: 32.9&lt;br /&gt;
 Skaičius? '''10.00'''&lt;br /&gt;
 Dabartinė suma: 42.9&lt;br /&gt;
 Skaičius? '''0'''&lt;br /&gt;
 Galutinė suma = 42.9&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad &amp;lt;code&amp;gt;print('Galutinė suma =', s)&amp;lt;/code&amp;gt; yra paleidžiama tik pačiame gale. Teiginys &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; veikia tik tas eilutes, kurios yra atitrauktos nuo krašto ir priklauso ciklo &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; blokui. &amp;lt;code&amp;gt;! =&amp;lt;/code&amp;gt; reiškia nelygu, taigi &amp;lt;code&amp;gt;while a! = 0:&amp;lt;/code&amp;gt; reiškia tol, kol &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; nėra nulis, programa vykdo kodą.&lt;br /&gt;
&lt;br /&gt;
Ar pastebėjai, kad šiuo atveju &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; yra skaičius su reikšme po kablelio ir ne visi tokie skaičiai gali būti tiksliai atvaizduoti, kai naudojamas &amp;lt;code&amp;gt;!=&amp;lt;/code&amp;gt;. Pabandyk paleidęs programą įvesti 1.1&lt;br /&gt;
&lt;br /&gt;
==== Begaliniai ciklai (infinitive loops) arba niekada nesibaigaintys ciklai (Never Ending Loop)====&lt;br /&gt;
Dabar, kai jau išsiaiškinome, kas yra ciklas &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt;, pasižiūrėkime kaip atrodo niekada nesibaigiantys ciklai, kaip kad ir šis:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
while True:&lt;br /&gt;
   print(&amp;quot;Padėk! Užstrigau cikle!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Operatorius &amp;lt;code&amp;gt;== &amp;lt;/code&amp;gt; naudojamas abiejų operatoriaus pusių išraiškų lygybei patikrinti, kaip ir &amp;lt;code&amp;gt; &amp;amp; lt; &amp;lt;/code&amp;gt; buvo naudojami norint pasakyt „mažiau nei“ (kitame skyriuje rasi išsamų visų palyginimo operatorių sąrašą). &lt;br /&gt;
&lt;br /&gt;
Ši mūsų sukurta programa spausdins &amp;lt;code&amp;gt;Padėk! Užstrigau cikle!&amp;lt;/code&amp;gt; visą amžinybę... Tol, kol pats ją sustabdysi, todėl kad ji visą laiką yra &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; (visada atitinka teigiamą reikšmę) arba kitaip tariant 1 reikšmės. Kaip programaą sustabdyti? Paprasčiausiai paspausk ctrl + c mygtukus.&lt;br /&gt;
&lt;br /&gt;
=== Pavyzdžiai ===&lt;br /&gt;
==== Fibonačio seka ====&lt;br /&gt;
'''Fibonacci-metodas1.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Ši programa skaičiuoja Fibonačio seką&lt;br /&gt;
a = 0&lt;br /&gt;
b = 1&lt;br /&gt;
pradinis_skačius = 0&lt;br /&gt;
maksimalus_skaičius = 20&lt;br /&gt;
&lt;br /&gt;
while pradinis_skačius &amp;lt; maksimalus_skaičius:&lt;br /&gt;
    pradinis_skačius = pradinis_skačius + 1&lt;br /&gt;
    print(a, end=&amp;quot; &amp;quot;)  # Atkreipkite dėmesį į end=&amp;quot; &amp;quot; spausdinimo funkcijos argumentuose  &lt;br /&gt;
                       # tai neleidžia sukurti naujos eilutės.&lt;br /&gt;
    senas_a = a    # turime sekti, nes mes jį keičiame.&lt;br /&gt;
    a = b&lt;br /&gt;
    b = senas_a + b&lt;br /&gt;
print()  # gauna naują (tuščią) eilutę.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Išvestis :&lt;br /&gt;
 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181&lt;br /&gt;
&lt;br /&gt;
Įsidėmėk, kad išvestis yra vienoje eilutėje dėl papildomų argumentų &amp;lt;code&amp;gt;pabaiga=&amp;quot; &amp;quot;&amp;lt;/code&amp;gt; argumentuose &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Fibonacci-metodas2.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Supaprastintas ir greitesnis Fibonačio sekos apskaičiavimo metodas&lt;br /&gt;
a = 0&lt;br /&gt;
b = 1&lt;br /&gt;
pradinis_skačius = 0&lt;br /&gt;
maksimalus_skaičius = 10&lt;br /&gt;
&lt;br /&gt;
while pradinis_skačius &amp;lt; maksimalus_skaičius:&lt;br /&gt;
    pradinis_skačius = pradinis_skačius + 1&lt;br /&gt;
    print(a, b, end=&amp;quot; &amp;quot;)  # Įsidėmėk end=&amp;quot; &amp;quot;&lt;br /&gt;
    a = a + b    &lt;br /&gt;
    b = a + b&lt;br /&gt;
print()  # gauna naują (tuščią) eilutę.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Išvestis:&lt;br /&gt;
 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181&lt;br /&gt;
&lt;br /&gt;
'''Fibonacci-metodas3.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 0&lt;br /&gt;
b = 1&lt;br /&gt;
pradinis_skačius = 0&lt;br /&gt;
maksimalus_skaičius = 20&lt;br /&gt;
&lt;br /&gt;
#kai ciklas prasideda, mes jame pasiliekame&lt;br /&gt;
while pradinis_skačius &amp;lt; maksimalus_skaičius:&lt;br /&gt;
    pradinis_skačius += 1&lt;br /&gt;
    senas_a = a&lt;br /&gt;
    a = a + b&lt;br /&gt;
    b = senas_a&lt;br /&gt;
    print(senas_a,end=&amp;quot; &amp;quot;)&lt;br /&gt;
print()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Išvestis:&lt;br /&gt;
 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181&lt;br /&gt;
&lt;br /&gt;
==== Įvesk slaptažodį ====&lt;br /&gt;
'''Slaptaždis.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Laukia, kol bus įvestas slaptažodis. Naudok „ctrl+ C“, kad sustabdytum programą&lt;br /&gt;
# be slaptažodžio&lt;br /&gt;
&lt;br /&gt;
#atkreipk dėmesį, kad tai neturi būti slaptažodis, kad&lt;br /&gt;
# ciklas while turi prasisukti bent kartą.&lt;br /&gt;
slaptažodis= str()&lt;br /&gt;
&lt;br /&gt;
# įsidėmėk != reiškia nelygu&lt;br /&gt;
while slaptažodis!= &amp;quot;Angis&amp;quot;:&lt;br /&gt;
    slaptažodis = input(&amp;quot;Slaptažodis: &amp;quot;)&lt;br /&gt;
print(&amp;quot;Prisijungimas sėkmingas&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kaip programa veikia:&lt;br /&gt;
 Slaptažodis: '''auo'''&lt;br /&gt;
 Slaptažodis: '''y22'''&lt;br /&gt;
 Slaptažodis: '''slaptažodis'''&lt;br /&gt;
 Slaptažodis: '''Sezamai atsiverk''&lt;br /&gt;
 Slaptažodis: '''Angis'''&lt;br /&gt;
 Prisijungimas sėkmingas&lt;br /&gt;
&lt;br /&gt;
=== Užduotis===&lt;br /&gt;
Parašyk programą, kuri prašo: vartotojo prisijungimo vardo ir slaptažodžio. Tada, kai vartotojas įveda „užrakinti“, jis turi įvesti savo vardą ir slaptažodį, kad atrakintų programą.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;mw-collapsible mw-collapsed wikitable&amp;quot;&lt;br /&gt;
! colspan=2 | Sprendimas &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
vardas = input(&amp;quot;Koks tavo prisijungimo vardas?: &amp;quot;)&lt;br /&gt;
slaptažodis = input(&amp;quot;Koks tavo slaptažodis: &amp;quot;)&lt;br /&gt;
print(&amp;quot;Kad užrakintum kompiuterį, parašyk: užrakinti&amp;quot;)&lt;br /&gt;
įvesta_komanda = None&lt;br /&gt;
input1 = None&lt;br /&gt;
input2 = None&lt;br /&gt;
while įvesta_komanda != &amp;quot;užrakinti&amp;quot;:&lt;br /&gt;
    įvesta_komanda = input(&amp;quot;Kokia tavo komanda: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
while input1 != vardas:&lt;br /&gt;
    input1 = input(&amp;quot;Tavo prisijungimo vardas: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
while input2 != slaptažodis:&lt;br /&gt;
    input2 = input(&amp;quot;Tavo slaptažodis: &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;Prisijungimas sėkmingas&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Jei nori, kad programa veiktų nepertraukiamai, tiesiog pridėk &amp;lt;code&amp;gt;while 1 == 1: &amp;lt;/code&amp;gt;prieš visą programą. Tik nepamiršk, kad reikia visą likusią programos dalį, t.y. ciklo bloką reikia atitraukti nuo krašto.&lt;br /&gt;
&lt;br /&gt;
Kitas sprendimo būdas&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
vardas = input('Nustatyti vardą: ')&lt;br /&gt;
slaptažodis = input('Nustatyti slaptažodį: ')&lt;br /&gt;
while 1 == 1:&lt;br /&gt;
    vardospėjimas=&amp;quot;&amp;quot;&lt;br /&gt;
    slaptažodžiospėjimas=&amp;quot;&amp;quot;&lt;br /&gt;
    raktas=&amp;quot;&amp;quot;&lt;br /&gt;
    while (vardospėjimas!= vardas) or (slaptažodžiospėjimas!= slaptažodis):&lt;br /&gt;
        vardospėjimas = input('Vardas? ')&lt;br /&gt;
        slaptažodžiospėjimas= input('Slaptažodis? ')&lt;br /&gt;
    print(&amp;quot;Labas,&amp;quot;, vardas, &amp;quot;. Parašyk užrakinti, kad užrakintum.&amp;quot;)&lt;br /&gt;
    while raktas != &amp;quot;užrakinti&amp;quot;:&lt;br /&gt;
        raktas = input(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį į &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt;, kuris yra prie &amp;lt;code&amp;gt;(vardospėjimas!= vardas) or (slaptažodžiospėjimas!= slaptažodis)&amp;lt;/code&amp;gt;, kurių dar neįvedėme. Pabandyk suprasti šią logiką ir kaip ji veikia.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Kas čia eina? |next=Pasirinkimai}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Kas_%C4%8Dia_eina%3F&amp;diff=3752</id>
		<title>Python Vadovėlis/Kas čia eina?</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Kas_%C4%8Dia_eina%3F&amp;diff=3752"/>
		<updated>2022-01-07T14:15:40Z</updated>

		<summary type="html">&lt;p&gt;Mantas: /* Įvestis ir kintamieji */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Įvestis ir kintamieji ===&lt;br /&gt;
Jaučiu, kad atėjo laikas tikrai sudėtingai programai. Štai ji:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Stop!&amp;quot;)&lt;br /&gt;
vartotojo_įvestis = input(&amp;quot;Kas čia eina? &amp;quot;)&lt;br /&gt;
print(&amp;quot;Gali praeiti,&amp;quot;,  vartotojo_įvestis )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kai '''Aš''' paleidau programą, štai ką '''mano''' ekranas parodė:&lt;br /&gt;
&lt;br /&gt;
 Stop!&lt;br /&gt;
 Kas čia eina? '''Jonas'''&lt;br /&gt;
 Gali praeiti, Jonas&lt;br /&gt;
&lt;br /&gt;
''Pastaba: Jei paleisi kodą spausdamas &amp;quot;F5&amp;quot;, python shell išves tik tiek:''&lt;br /&gt;
&lt;br /&gt;
 Stop!&lt;br /&gt;
 Kas čia eina?&lt;br /&gt;
&lt;br /&gt;
''Tu turi įvesti savo vardą į python shell ir tada paspausti enter norėdama/s pamatyt likusį tekstą.''&lt;br /&gt;
&lt;br /&gt;
Žinoma, kai tu paleisi programą, tavo ekranas atrodys kitaip dėl &amp;lt;code&amp;gt;input()&amp;lt;/code&amp;gt; užklausos.&lt;br /&gt;
Kai paleidai programą (juk paleidai, tiesa?), tu turėjai surinkti savo vardą ir tada paspausti Enter.&lt;br /&gt;
Programa atspausdino dalį teksto ir tavo vardą. Taip atrodo ''įvesties'' pavyzdys.&lt;br /&gt;
Programa pasiekia tam tikrą kodo tašką ir laukia vartotojo įvesties, kad duomenis galėtų panaudoti tolimesniuose procesuose.&lt;br /&gt;
&lt;br /&gt;
Žinoma, gauti informaciją iš vartotojo pasaulio nieko verta, jei tos informacijos nėra kur padėti. Ir šioje vietoje atsiranda kintamieji.  &lt;br /&gt;
&lt;br /&gt;
Pavyzdinėje programoje &amp;lt;code&amp;gt;user_input&amp;lt;/code&amp;gt; yra ''kintamasis''. Kintamieji yra kaip dėžės, į kurias galima įdėti norimas informacijos dalis.  &lt;br /&gt;
&lt;br /&gt;
Štai programa, parodanti kintamųjų pavyzdžius:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 123.4&lt;br /&gt;
b23 = 'Šlamštas'&lt;br /&gt;
vardas = &amp;quot;Jonas&amp;quot;&lt;br /&gt;
b = 432&lt;br /&gt;
c = a + b&lt;br /&gt;
print(&amp;quot;a + b yra&amp;quot;,c)&lt;br /&gt;
print(&amp;quot;vardas yra&amp;quot;,vardas)&lt;br /&gt;
print(&amp;quot;Rūšiuotos dalys, Po vidurnakčio ar&amp;quot;,b23)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Štai kokia išvestis:&lt;br /&gt;
&lt;br /&gt;
 a + b yra 555.4&lt;br /&gt;
 vardas yra Jonas&lt;br /&gt;
 Rūšiuotos dalys, Po vidurnakčio ar Šlamštas&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kintamieji laiko duomenis. Viršuje aprašytoje programoje kintamieji yra &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;b23&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;vardas&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; ir &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt;. Pagrindiniai du kintamųjų tipai yra ''tekstas'' ir ''skaičius''. Tekstas yra raidžių, skaičių ir kitų simbolių seka. Šiame pavyzdyje &amp;lt;code&amp;gt;b23&amp;lt;/code&amp;gt; ir &amp;lt;code&amp;gt;vardas&amp;lt;/code&amp;gt; yra tekstinio tipo kintamieji. &amp;lt;code&amp;gt;Šlamštas&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Jonas&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;a + b yra&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;vardas yra&amp;lt;/code&amp;gt;, ir &amp;lt;code&amp;gt;Rūšiuotos dalys, Po vidurnakčio ar&amp;lt;/code&amp;gt; šioje programoje yra tiesiog tekstinės reikšmės. Paprastas tekstas yra apsuptas kabučių &amp;lt;code&amp;gt;&amp;quot;&amp;lt;/code&amp;gt; arba &amp;lt;code&amp;gt;'&amp;lt;/code&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
Kitas kintamojo tipas yra skaičius. Atkreipkite dėmesį, kad kintamieji, kurie naudojami saugoti reikšmes, nenaudoja kabučių (&amp;quot; ir '). Jei norite naudoti realias ''reikšmes'', privalote naudoti kabutes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
reikšmė1 == Oho&lt;br /&gt;
reikšmė2 == &amp;quot;Oho&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Abu pavyzdžiai atrodo vienodai, bet pirmu atveju Python tikrins ar reikšmė, patalpinta kintamajame &amp;lt;code&amp;gt;reikšmė1&amp;lt;/code&amp;gt;, yra tokia pati kaip ''kintamojo'' &amp;lt;code&amp;gt;Oho&amp;lt;/code&amp;gt;. Antrame pavyzdyje Python tikrins ar tekstas (konkrečios raidės &amp;lt;code&amp;gt;O&amp;lt;/code&amp;gt;,&amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt; ir &amp;lt;code&amp;gt;o&amp;lt;/code&amp;gt;) yra tokios pat kaip ir &amp;lt;code&amp;gt;reikšmė2&amp;lt;/code&amp;gt; (toliau daugiau paaiškinsiu apie tekstą ir &amp;lt;code&amp;gt;==&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Priskyrimai ===&lt;br /&gt;
&lt;br /&gt;
Gerai, dabar mes turime dėžutes, pavadintas kintamaisiais, taip pat informaciją, kuri gali būti kintamajame. Kompiuteris pamatys tokią eilutę &amp;lt;code&amp;gt;vardas = &amp;quot;Jonas&amp;quot;&amp;lt;/code&amp;gt; ir perskaitys ją kaip &amp;quot;Padėk tekstą &amp;lt;code&amp;gt;Jonas&amp;lt;/code&amp;gt; į dėžę (ar kintamąjį) &amp;lt;code&amp;gt;vardas&amp;lt;/code&amp;gt;&amp;quot;. Vėliau, pamatęs sakinį &amp;lt;code&amp;gt;c = a + b&amp;lt;/code&amp;gt; jį perskaitys kaip &amp;quot;padėt sumą &amp;lt;code&amp;gt;a + b&amp;lt;/code&amp;gt; arba &amp;lt;code&amp;gt;123.4 + 432&amp;lt;/code&amp;gt;, kas lygu &amp;lt;code&amp;gt;555.4&amp;lt;/code&amp;gt;, į &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt;&amp;quot;. Dešinė sakinio pusė ''konvertuosis'' ir rezultatas bus padėtas į kintamajį kairėje pusėje (&amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt;). Tai yra vadinama ''priskyrimu''. Turėtume nemaišyti priskyrimo ir matematinio lygybės ženklo (&amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt;). Ką reiškia &amp;lt;code&amp;gt;==&amp;lt;/code&amp;gt; aptarsime vėliau.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
O štai ir kitas kintamųjų naudojimo pavyzdys:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 1&lt;br /&gt;
print(a)&lt;br /&gt;
a = a + 1&lt;br /&gt;
print(a)&lt;br /&gt;
a = a * 2&lt;br /&gt;
print(a)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ir žinoma štai tokį rezultatą gausime:&lt;br /&gt;
&lt;br /&gt;
 1&lt;br /&gt;
 2&lt;br /&gt;
 4&lt;br /&gt;
&lt;br /&gt;
Net jei kintamieji yra abiejose lygybės pusėse (pavyzdžiui šlamštas = šlamštas), kompiuteris vis tiek perskaitys taip: &amp;quot;Pirmiausia surask informaciją, kuri patalpinta ir tada surask, kur ją padėti&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Dar viena programa prieš man pabangiant šį skyrių:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
skaičius = float(input(&amp;quot;Įvesk skaičių: &amp;quot;))&lt;br /&gt;
sveikasSkaičius = int(input(&amp;quot;Įvesk sveiką skaičių: &amp;quot;))&lt;br /&gt;
tekstas = input(&amp;quot;Įvesk tekstą: &amp;quot;)&lt;br /&gt;
print(&amp;quot;skaičius =&amp;quot;, skaičius)&lt;br /&gt;
print(&amp;quot;skaičius yra&amp;quot;, type(skaičius))&lt;br /&gt;
print(&amp;quot;skaičius * 2 =&amp;quot;, skaičius * 2)&lt;br /&gt;
print(&amp;quot;sveikas skaičius =&amp;quot;, sveikasSkaičius)&lt;br /&gt;
print(&amp;quot;sveikas skaičius yra&amp;quot;, type(sveikasSkaičius))&lt;br /&gt;
print(&amp;quot;sveikasSkaičius * 2 =&amp;quot;, sveikasSkaičius * 2)&lt;br /&gt;
print(&amp;quot;tekstas =&amp;quot;, tekstas)&lt;br /&gt;
print(&amp;quot;tekstas yra&amp;quot;, type(tekstas))&lt;br /&gt;
print(&amp;quot;tekstas * 2 =&amp;quot;, tekstas * 2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Įvesk skaičių: '''12.34'''&lt;br /&gt;
 Įvesk sveiką skaičių: '''-3'''&lt;br /&gt;
 Įvesk tekstą: '''Labas'''&lt;br /&gt;
 skaičius = 12.34&lt;br /&gt;
 skaičius yra &amp;lt;class 'float'&amp;gt;&lt;br /&gt;
 skaičius * 2 = 24.68&lt;br /&gt;
 sveikas skaičius = -3&lt;br /&gt;
 sveikas skaičius yra &amp;lt;class 'int'&amp;gt;&lt;br /&gt;
 sveikasSkaičius * 2 = -6&lt;br /&gt;
 tekstas = Labas&lt;br /&gt;
 tekstas yra &amp;lt;class 'str'&amp;gt;&lt;br /&gt;
 tekstas * 2 = LabasLabas&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad &amp;lt;code&amp;gt;skaičius&amp;lt;/code&amp;gt; buvo sukurtas su &amp;lt;code&amp;gt;float(input())&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;int(input())&amp;lt;/code&amp;gt; grąžina sveiką skaičių - reikšmę be kablelio, kai tuo tarpu &amp;lt;code&amp;gt;tekstas&amp;lt;/code&amp;gt; buvo sukurtas su &amp;lt;code&amp;gt;input()&amp;lt;/code&amp;gt; grąžino tekstinę eilutę (gali būti aprašoma ir &amp;lt;code&amp;gt;str(input())&amp;lt;/code&amp;gt;). Jei tu nori, kad vartotojas įvestų skaičių su kableliu, naudok &amp;lt;code&amp;gt;float(input())&amp;lt;/code&amp;gt; kintamojo tipą. Jei nori, kad vartotojas įvestų sveiką skaičių, naudok &amp;lt;code&amp;gt;int(input())&amp;lt;/code&amp;gt;, bet jei nori teksto - naudok &amp;lt;code&amp;gt;input()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Antra pusė programos naudoja &amp;lt;code&amp;gt;type()&amp;lt;/code&amp;gt; funkciją, kuri nusako, kokio tipo kintamasis yra. Skaičius yra &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; arba &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt; tipo. Tai yra angliškų žodžių ''integer'' (sveikas skaičius) ir ''floating point'' (slankusis kablelis, naudojamas daugiausiai skaičiams su kableliu) trumpiniai. Tekstinė eilutė yra &amp;lt;code&amp;gt;str&amp;lt;/code&amp;gt;, trumpinys ''string'' (tekstinė eilutė). Sveiki skaičiai ir slankusis kablelis gali būti naudojami matematinėms funkcijoms, tekstas - ne. Atkreipk dėmesį, kai Python'as daugina skaičių iš sveiko skaičiaus gaunamas rezultatas, kurio ir galima tikėtis, tačiau jei tekstas padauginamas iš sveiko skaičiaus - sukuriamos kelios teksto kopijos (pavyzdžiui, &amp;lt;code&amp;gt;tekstas * 2 = LabasLabas&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Operacijos su tekstu daro kitokius dalykus nei operacijos su skaičiaus. Taip pat, kai kurios operacijos veikia tik su skaičiais ir grąžina klaidą, jei bus bandoma panaudoti tesktą. Štai keletas interaktyvių pavyzdžių:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(&amp;quot;Čia&amp;quot; + &amp;quot; &amp;quot; + &amp;quot;yra&amp;quot; + &amp;quot; junginys.&amp;quot;)&lt;br /&gt;
Čia yra junginys.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(&amp;quot;Ha, &amp;quot; * 5)&lt;br /&gt;
Ha, Ha, Ha, Ha, Ha, &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(&amp;quot;Ha, &amp;quot; * 5 + &amp;quot;ha!&amp;quot;)&lt;br /&gt;
Ha, Ha, Ha, Ha, Ha, ha!&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(3 - 1)&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(&amp;quot;3&amp;quot; - &amp;quot;1&amp;quot;)&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;
  File &amp;quot;&amp;lt;string&amp;gt;&amp;quot;, line 1, in &amp;lt;module&amp;gt;&lt;br /&gt;
TypeError: unsupported operand type(s) for -: 'str' and 'str'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Štai sąrašas kelių operacijų su tekstu:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Operation &lt;br /&gt;
!Symbol &lt;br /&gt;
!Example&lt;br /&gt;
|-&lt;br /&gt;
|Pakartojimas&lt;br /&gt;
|&amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; &lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;i&amp;quot; * 5 == &amp;quot;iiiii&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Sujungimas&lt;br /&gt;
|&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;Hello, &amp;quot; + &amp;quot;World!&amp;quot; == &amp;quot;Hello, World!&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Pavyzdžiai ===&lt;br /&gt;
&lt;br /&gt;
'''Laikas.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# ši programa apskaičiuoja laiko priklausomybę nuo greičio ir atstumo&lt;br /&gt;
print(&amp;quot;Įvesk greitį ir atstumą&amp;quot;)&lt;br /&gt;
greitis = float(input(&amp;quot;Greitis: &amp;quot;))&lt;br /&gt;
atstumas = float(input(&amp;quot;Atstumas: &amp;quot;))&lt;br /&gt;
laikas = (atstumas / greitis)&lt;br /&gt;
print(&amp;quot;Laikas:&amp;quot;, laikas)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Įvesk greitį ir atstumą&lt;br /&gt;
 Greitis: '''5'''&lt;br /&gt;
 Atstumas: '''10'''&lt;br /&gt;
 Laikas: 2.0&lt;br /&gt;
&lt;br /&gt;
 Įvesk greitį ir atstumą&lt;br /&gt;
 Greitis: '''3.52'''&lt;br /&gt;
 Atstumas: '''45.6'''&lt;br /&gt;
 Laikas: 12.9545454545&lt;br /&gt;
&lt;br /&gt;
'''Plotas.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Ši programa apskaičiuoja stačiakampio perimetrą ir plotą &lt;br /&gt;
print(&amp;quot;Įveskite stačiakampio informaciją&amp;quot;)&lt;br /&gt;
ilgis = float(input(&amp;quot;Ilgis: &amp;quot;))&lt;br /&gt;
plotis = float(input(&amp;quot;Plotis: &amp;quot;))&lt;br /&gt;
perimetras = (2 * ilgis + 2 * plotis) &lt;br /&gt;
print(&amp;quot;Plotas:&amp;quot;, ilgis * plotis)&lt;br /&gt;
print(&amp;quot;Perimetras:&amp;quot;, perimetras)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pavyzdžio rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Įveskite stačiakampio informaciją&lt;br /&gt;
 Ilgis: '''4'''&lt;br /&gt;
 Plotis: '''3'''&lt;br /&gt;
 Plotas: 12.0&lt;br /&gt;
 Perimetras: 14.0&lt;br /&gt;
&lt;br /&gt;
 Įveskite stačiakampio informaciją&lt;br /&gt;
 Ilgis: '''2.53'''&lt;br /&gt;
 Plotis: '''5.2'''&lt;br /&gt;
 Plotas: 13.156&lt;br /&gt;
 Perimetras: 15.46&lt;br /&gt;
&lt;br /&gt;
'''temperatura.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Ši programa konvertuoja temperatūra iš Farenheitų į Celsijų&lt;br /&gt;
far_temp = float(input(&amp;quot;Temperatūra Farenheitais: &amp;quot;))&lt;br /&gt;
cels_temp = (far_temp - 32.0) * (5.0 / 9.0)&lt;br /&gt;
print(&amp;quot;Temperatūra Celsijaus laipsniais:&amp;quot;, cels_temp )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pavyzdžio rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Temperatūra Farenheitais: '''32'''&lt;br /&gt;
 Temperatūra Celsijaus laipsniais: 0.0&lt;br /&gt;
&lt;br /&gt;
 Temperatūra Farenheitais: '''-40'''&lt;br /&gt;
 Temperatūra Celsijaus laipsniais: -40.0&lt;br /&gt;
&lt;br /&gt;
 Temperatūra Farenheitais: '''212'''&lt;br /&gt;
 Temperatūra Celsijaus laipsniais: 100.0&lt;br /&gt;
&lt;br /&gt;
 Temperatūra Farenheitais: '''98.6'''&lt;br /&gt;
 Temperatūra Celsijaus laipsniais: 37.0&lt;br /&gt;
&lt;br /&gt;
=== Užduotis ===&lt;br /&gt;
Parašyti programą, kuri priima 2 tekstines reikšmes ir 2 skaičius iš vartotojo įvesties, sujungia tekstus be tarpų ir atvaizduoja gautą rezultatą, o tada sudaugina du skaičius ir atvaizduoja naujoje eilutėje.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;mw-collapsible mw-collapsed wikitable&amp;quot;&lt;br /&gt;
! colspan=2 | Sprendimas &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;  &lt;br /&gt;
tekstas1 = input('Tekstas 1: ')&lt;br /&gt;
tekstas2 = input('Tekstas 2: ')&lt;br /&gt;
skaičius1 = float(input('Skaičius 1: '))&lt;br /&gt;
skaičius2 = float(input('Skaičius 2: '))&lt;br /&gt;
print(tekstas1 + tekstas2)&lt;br /&gt;
print(skaičius1 * skaičius2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Labas, Pasauli |next=Suskaičiuoti iki 10}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Labas,_Pasauli&amp;diff=3751</id>
		<title>Python Vadovėlis/Labas, Pasauli</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Labas,_Pasauli&amp;diff=3751"/>
		<updated>2022-01-07T14:05:08Z</updated>

		<summary type="html">&lt;p&gt;Mantas: /* Komentarai */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Now for our first lesson, what is a computer program?  A computer program is a set of very detailed instructions that tell a computer what to do.   --&amp;gt;&lt;br /&gt;
=== Ką sužinosi? ===&lt;br /&gt;
Perskaitęs šį skyrių, turėtum suprasti kaip teksto redaktoriumi rašyti programas, kaip parašytas programas išsaugoti kompiuterio atmintyje ir kaip jas paleisti.&lt;br /&gt;
&lt;br /&gt;
=== Spausdinimas ===&lt;br /&gt;
Istoriškai taip jau susiklostė, kad programavimo pamokos dažniausiai prasideda nuo mažos ir paprastos programėlės pavadinimu „Hello, World!“ arba lietuviškai [[„Labas, Pasauli!“]].&lt;br /&gt;
&lt;br /&gt;
Python'o programavimo kalboje programa atrodytų taip: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Programavimas kodo redaktoriumi ====&lt;br /&gt;
&lt;br /&gt;
Programavimui rekomenduojame naudoti kodo redaktorių &amp;lt;code&amp;gt;LR NŠA Python&amp;lt;/code&amp;gt;, kaip aprašytą skyriuje [[Non-Programmer's Tutorial for Python 3/Intro#Creating_and_Running_Programs|Programų kūrimas ir paleidimas]]. Savo kompiuteryje atsidaryk šią programavimo aplinką, sukurk naują failą (File -&amp;gt; New File), įkopijuok šį kodą ir tuomet failą išsaugok (File -&amp;gt; Save) pavadinimu &amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
Sveikiname! Sukūrei savo pirmą Python programą.&lt;br /&gt;
&lt;br /&gt;
(Jeigu tokios programavimo aplinkos įsidiegti savo kompiuteryje negali, žr. kitą žingsnį).&lt;br /&gt;
&lt;br /&gt;
Dabar parašytą programą paleisk vykdyti: tiesiog paspausk žalią mygtuką dešinėje viršuje.&lt;br /&gt;
&lt;br /&gt;
Kai paleisi šią programą, ji suveiks ir terminale atsiras užrašas:&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli!&lt;br /&gt;
&lt;br /&gt;
==== Alternatyvus būdas: Programavimas paprastu teksto redaktoriumi ====&lt;br /&gt;
&lt;br /&gt;
Jeigu kodo redaktoriaus negali įsidiegti savo kompiuteryje dėl kokių nors priežasčių, programuoti galima ir tiesiog paprasčiausiu teksto redaktoriumi, pvz., Notepad.  &lt;br /&gt;
&lt;br /&gt;
Tiesiog sukurk naują paprastą tekstinį failą (.txt), jame įrašyk programinį kodą &amp;lt;code&amp;gt;print(&amp;quot;Labas, Pasauli!&amp;quot;)&amp;lt;/code&amp;gt;, failą išsaugok pavadinimu &amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
Dabar parašytą programą paleisk vykdyti, tiesiog konsolėje parašęs &amp;lt;code&amp;gt;python3 hello.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tavo programa parašys: &lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli!&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
=== Eime toliau ===&lt;br /&gt;
&lt;br /&gt;
Labai rekomenduojame kiekvieną programos pavyzdį pasibandyti pačiam - parašyk ir tada pasileisk programą. Mūsų praktikoje toks mokymosi procesas yra pats efektyviausias ir veiksmingiausias.&lt;br /&gt;
&lt;br /&gt;
Na, o dabar keliaukime prie kiek sudėtingesnės programos pavyzdžio:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;)&lt;br /&gt;
print(&amp;quot;Parsinešti puodą vandens.&amp;quot;)&lt;br /&gt;
print(&amp;quot;Benas nukrito ir susidaužė karūną,&amp;quot;)&lt;br /&gt;
print(&amp;quot;Ir Liepa suklupo taip pat.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kai paleidi šią programą, ji parašo trumpą istoriją:&lt;br /&gt;
&lt;br /&gt;
 Benas ir Liepa lipo į kalną&lt;br /&gt;
 Parsinešti puodą vandens.&lt;br /&gt;
 Benas nukrito ir susidaužė karūną, &lt;br /&gt;
 Ir Liepa suklupo taip pat.&lt;br /&gt;
&lt;br /&gt;
Kai kompiuteris paleidžia programą, pirmiausia jis mato:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Todėl kompiuteris užrašo:&lt;br /&gt;
&lt;br /&gt;
 Benas ir Liepa lipo į kalną&lt;br /&gt;
&lt;br /&gt;
Tada kompiuteris skaito kitą eilutę ir mato:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Parsinešti puodą vandens.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Todėl ir ją užrašo kompiuterio ekrane:&lt;br /&gt;
&lt;br /&gt;
 Parsinešti puodą vandens.&lt;br /&gt;
&lt;br /&gt;
Taip kompiuteris žiūri į kiekvieną eilutę *iš eilės*, ir ją įvykdęs ir eina toliau: skaito kitą eilutę, ją įvykdo ir t.t. Taip kompiuteris vykdo visas surašytas komandas, kol pasiekia programos pabaigą.&lt;br /&gt;
&lt;br /&gt;
==== Terminologija ====&lt;br /&gt;
Taigi pats laikas truputį paaiškinti, kas vyksta ir trumpai supažindinti su terminologija.&lt;br /&gt;
&lt;br /&gt;
Prieš tai rašydami kodą, mes naudojame „funkciją“ pavadinimu &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt;. Po funkcijos pavadinimo &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; rašomi skliausteliai &amp;lt;code&amp;gt;()&amp;lt;/code&amp;gt;, kuriuose nurodome tos funkcijos parametrus/argumentus. Pažiūrėk į pavyzdį:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
funkcijai duodamas vienas parametras, kuris yra &amp;lt;code&amp;gt;&amp;quot;Labas, Pasauli!&amp;quot;&amp;lt;/code&amp;gt;. Ar pastebėjai, kad šis parametras, sudarytas iš simbolių grupės, kuri įrašyta tarp dviejų kabučių (&amp;quot;&amp;quot;)? Programuotojai tai vadina „rašytinių simbolių seka“ ar trumpiau tariant „eilute“ (tekstine reikšme). Kitas tekstinės reikšmės pavyzdys yra &amp;lt;code&amp;gt;&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Užrašyta funkcija su argumentais yra „teiginys“, kurį supranta Python'as. Sakinio pavyzdys:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paprasčiau tariant, teiginį gali įsivaizduoti kaip vieną programos eilutę.  &lt;br /&gt;
&lt;br /&gt;
Kol kas terminologijos pakaks, keliaujam į kitą poskyrį ir mokomės toliau.&lt;br /&gt;
&lt;br /&gt;
====\n rašyme====&lt;br /&gt;
&amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt;, arba nauja eilutė. Rašant tekstą, visas tekstas po \n yra užrašomas naujoje eilutėje. Taip pat &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; gali būti naudojamas kaip „pabėgimo simbolis“ (escape character). Pabandyk suprasti šią programą:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!\nKą turėčiau daryti?&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kurios rezultatas yra toks:&lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli! &lt;br /&gt;
 Ką turėčiau daryti?&lt;br /&gt;
&lt;br /&gt;
Taip pat &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; naudojamas, kai norime tekstą perkelti į kitą eilutę, bet nenorime naudoti kelių &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt; komandų.&lt;br /&gt;
&lt;br /&gt;
Be to, spausdinimo teiginys automatiškai naudoja &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt;, net jeigu pats &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; ir neužrašai. Paprasčiau suprasti bus pamačius pavyzdį:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iš tikrųjų yra:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!\n&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Išraiškos ===&lt;br /&gt;
Programos pavyzdys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;2 + 2 yra&amp;quot;, 2 + 2)&lt;br /&gt;
print(&amp;quot;3 * 4 yra&amp;quot;, 3 * 4)&lt;br /&gt;
print(&amp;quot;100 - 1 yra&amp;quot;, 100 - 1)&lt;br /&gt;
print(&amp;quot;((33 + 2) / 5 + 11.5 yra&amp;quot;, (33 + 2) / 5 + 11.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 2 + 2 yra 4&lt;br /&gt;
 3 * 4 yra 12&lt;br /&gt;
 100 - 1 yra 99&lt;br /&gt;
 (33 + 2) / 5 + 11.5 yra 18.5&lt;br /&gt;
&lt;br /&gt;
==== Aritmetinės išraiškos ====&lt;br /&gt;
&lt;br /&gt;
Šiame pavyzdyje, rašymo funkcija &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt; yra su dvejais argumentais, kurie atskirti kableliu. Taigi pirmoje programos eilutėje&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;2 + 2 yra&amp;quot;, 2 + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pirmas argumentas yra teksto eilutė &amp;lt;code&amp;gt;&amp;quot;2 + 2 yra&amp;quot;&amp;lt;/code&amp;gt; ir antras argumentas yra aritmetinė išraiška &amp;lt;code&amp;gt;2 + 2&amp;lt;/code&amp;gt;, tiksliau tariant viena iš aritmetinių išraiškų.&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad eilutė, kuri yra užrašyta kabutėse yra atspausdinama kaip tekstas, o išraiška užrašyta be kabučių yra apskaičiuojama ir užrašomas atsakymas.&lt;br /&gt;
&lt;br /&gt;
Python'o programavimo kalba turi septynias pagrindines skaičių operacijas.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Operacija &lt;br /&gt;
! Simbolis &lt;br /&gt;
! Pavyzdys&lt;br /&gt;
|-&lt;br /&gt;
|Kėlimas laipsniu  &lt;br /&gt;
| &amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;5 ** 2 == 25&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Daugyba &lt;br /&gt;
| &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; &lt;br /&gt;
|&amp;lt;code&amp;gt;2 * 3 == 6&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Dalyba &lt;br /&gt;
| &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;14 / 3 == 4.666666666666667&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Sveikųjų skaičių dalyba&lt;br /&gt;
| &amp;lt;code&amp;gt;//&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;14 // 3 == 4&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Liekana (modulis)&lt;br /&gt;
| &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;14 % 3 == 2&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Sudėtis&lt;br /&gt;
| &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;1 + 2 == 3&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Atimtis &lt;br /&gt;
| &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;4 - 3 == 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad yra du dalybos būdai: vienas grąžina pasikartojantį dešimtainį skaičių, o kitas - liekaną ir visą skaičių.&lt;br /&gt;
Operacijų tvarka tokia pati kaip matematikoje:&lt;br /&gt;
* skliausteliuose &amp;lt;code&amp;gt;()&amp;lt;/code&amp;gt;&lt;br /&gt;
* kėlimas laipsniu &amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt;&lt;br /&gt;
* daugyba &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;, dalyba&amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt;, sveikųjų skaičių dalyba &amp;lt;code&amp;gt;//&amp;lt;/code&amp;gt;, dalyba su liekana &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; &lt;br /&gt;
* sudėtis &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; ir atimtis &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taigi, užrašydamas formules, nepamiršk skliaustelių.&lt;br /&gt;
&lt;br /&gt;
=== Komentarai ===&lt;br /&gt;
&lt;br /&gt;
Rašant daug kodo, ateityje tikrai ne viską atsiminsi. Todėl programoje gali naudoti komentarus, kurie yra tiesiog pastabos/paaiškinimai sau pačiam arba kitiems programuotojams. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Skaičiaus PI išraiška kompiuterio ekrane&lt;br /&gt;
print(22 / 7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas: &lt;br /&gt;
&lt;br /&gt;
 3.14285714286&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad komentaras prasideda grotelių ženklu: &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. Komentarai yra skirti žmonėms, pagerinti programos skaitomumą. &lt;br /&gt;
&lt;br /&gt;
Taip pat svarbu suprasti, kad po &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; galima naudoti bet kokius ženklus ir kompiuteris visą šį tekstą ignoruos iki pat eilutės galo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Skaičiaus PI išraiška kompiuterio ekrane&lt;br /&gt;
print(22/7) # tokiu būdu gauname tik apytikslę PI reikšmę&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pavyzdžiai ===&lt;br /&gt;
Kiekvieno skyriaus gale bus pateikiami su skyriaus tema susiję pavyzdžiai. Turėtum juos peržvelgti ir išsiaiškinti ar supratai. Taip pat juos gali įsikelti į python kodo redaktorių ir pažiūrėti kaip viekia. Jeigu suprasi, keliauk toliau, jeigu ne, bandyk dar kartą perskaityti skyriaus medžiagą ir suprasti pavyzdžių logiką.&lt;br /&gt;
&lt;br /&gt;
'''Danija.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Būti ar nebūti, štai kur klausimas.&amp;quot;)&lt;br /&gt;
print(&amp;quot;                -- Šekspyras&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Būti ar nebūti, štai kur klausimas.&lt;br /&gt;
                 -- Šekspyras&lt;br /&gt;
&lt;br /&gt;
'''Mokykla.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Pirmoji klasė&amp;quot;)&lt;br /&gt;
print(&amp;quot;1 + 1 =&amp;quot;, 1 + 1)&lt;br /&gt;
print(&amp;quot;2 + 4 =&amp;quot;, 2 + 4)&lt;br /&gt;
print(&amp;quot;5 - 2 =&amp;quot;, 5 - 2)&lt;br /&gt;
print()&lt;br /&gt;
print(&amp;quot;Trečioji klasė&amp;quot;)&lt;br /&gt;
print(&amp;quot;243 - 23 =&amp;quot;, 243 - 23)&lt;br /&gt;
print(&amp;quot;12 * 4 =&amp;quot;, 12 * 4)&lt;br /&gt;
print(&amp;quot;12 / 3 =&amp;quot;, 12 / 3)&lt;br /&gt;
print(&amp;quot;13 / 3 =&amp;quot;, 13 // 3, &amp;quot;R&amp;quot;, 13 % 3)&lt;br /&gt;
print()&lt;br /&gt;
print(&amp;quot;Vidurinė&amp;quot;)&lt;br /&gt;
print(&amp;quot;123.56 - 62.12 =&amp;quot;, 123.56 - 62.12)&lt;br /&gt;
print(&amp;quot;(4 + 3) * 2 =&amp;quot;, (4 + 3) * 2)&lt;br /&gt;
print(&amp;quot;4 + 3 * 2 =&amp;quot;, 4 + 3 * 2)&lt;br /&gt;
print(&amp;quot;3 ** 2 =&amp;quot;, 3 ** 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Pirma klasė&lt;br /&gt;
 1 + 1 = 2&lt;br /&gt;
 2 + 4 = 6&lt;br /&gt;
 5 - 2 = 3&lt;br /&gt;
 &lt;br /&gt;
 Trečia klasė&lt;br /&gt;
 243 - 23 = 220&lt;br /&gt;
 12 * 4 = 48&lt;br /&gt;
 12 / 3 = 4&lt;br /&gt;
 13 / 3 = 4 R 1&lt;br /&gt;
 &lt;br /&gt;
 Vidurinė&lt;br /&gt;
 123.56 - 62.12 = 61.44&lt;br /&gt;
 (4 + 3) * 2 = 14&lt;br /&gt;
 4 + 3 * 2 = 10&lt;br /&gt;
 3 ** 2 = 9&lt;br /&gt;
&lt;br /&gt;
=== Pratimai ===&lt;br /&gt;
&lt;br /&gt;
# Parašyk programą, kuri atspausdintų tavo vardą ir gimimo datą atskirose eilutėse&lt;br /&gt;
# Parašyk programą, kuri parodytų visų 7 [[#Aritmetinės_išraiškos|artimetinių operacijų]] panaudojimą.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;mw-collapsible mw-collapsed wikitable&amp;quot;&lt;br /&gt;
! colspan=2 | Sprendimas #1 &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
1. Parašyk programą, kuri atspausdintų tavo vardą ir gimimo datą atskirose eilutėse&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Ada Lovelace&amp;quot;, &amp;quot;gimusi&amp;quot;, &amp;quot;lapkričio 27, 1852&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Albertas Einšteinas&amp;quot;, &amp;quot;gimęs&amp;quot;, &amp;quot;14 kovo 1879&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print((&amp;quot;Jonas Smitas&amp;quot;), (&amp;quot;gimęs&amp;quot;), (&amp;quot;14 kovo 1879&amp;quot;))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;mw-collapsible mw-collapsed wikitable&amp;quot;&lt;br /&gt;
! colspan=2 | Sprendimas #2 &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
2. Parašyk programą, kuri parodytų visų 7 [[#Aritmetinės_išraiškos|artimetinių operacijų]] panaudojimą.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;5**5 = &amp;quot;, 5**5)&lt;br /&gt;
print(&amp;quot;6*7 = &amp;quot;, 6*7)&lt;br /&gt;
print(&amp;quot;56/8 = &amp;quot;, 56/8)&lt;br /&gt;
print(&amp;quot;14//6 = &amp;quot;, 14//6)&lt;br /&gt;
print(&amp;quot;14%6 = &amp;quot;, 14%6)&lt;br /&gt;
print(&amp;quot;5+6 = &amp;quot;, 5+6)&lt;br /&gt;
print(&amp;quot;9-0 = &amp;quot;, 9-0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Išnašos====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Įvadas |next=Kas čia eina?}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Labas,_Pasauli&amp;diff=3750</id>
		<title>Python Vadovėlis/Labas, Pasauli</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Labas,_Pasauli&amp;diff=3750"/>
		<updated>2022-01-07T14:02:44Z</updated>

		<summary type="html">&lt;p&gt;Mantas: /* Aritmetinės išraiškos */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Now for our first lesson, what is a computer program?  A computer program is a set of very detailed instructions that tell a computer what to do.   --&amp;gt;&lt;br /&gt;
=== Ką sužinosi? ===&lt;br /&gt;
Perskaitęs šį skyrių, turėtum suprasti kaip teksto redaktoriumi rašyti programas, kaip parašytas programas išsaugoti kompiuterio atmintyje ir kaip jas paleisti.&lt;br /&gt;
&lt;br /&gt;
=== Spausdinimas ===&lt;br /&gt;
Istoriškai taip jau susiklostė, kad programavimo pamokos dažniausiai prasideda nuo mažos ir paprastos programėlės pavadinimu „Hello, World!“ arba lietuviškai [[„Labas, Pasauli!“]].&lt;br /&gt;
&lt;br /&gt;
Python'o programavimo kalboje programa atrodytų taip: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Programavimas kodo redaktoriumi ====&lt;br /&gt;
&lt;br /&gt;
Programavimui rekomenduojame naudoti kodo redaktorių &amp;lt;code&amp;gt;LR NŠA Python&amp;lt;/code&amp;gt;, kaip aprašytą skyriuje [[Non-Programmer's Tutorial for Python 3/Intro#Creating_and_Running_Programs|Programų kūrimas ir paleidimas]]. Savo kompiuteryje atsidaryk šią programavimo aplinką, sukurk naują failą (File -&amp;gt; New File), įkopijuok šį kodą ir tuomet failą išsaugok (File -&amp;gt; Save) pavadinimu &amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
Sveikiname! Sukūrei savo pirmą Python programą.&lt;br /&gt;
&lt;br /&gt;
(Jeigu tokios programavimo aplinkos įsidiegti savo kompiuteryje negali, žr. kitą žingsnį).&lt;br /&gt;
&lt;br /&gt;
Dabar parašytą programą paleisk vykdyti: tiesiog paspausk žalią mygtuką dešinėje viršuje.&lt;br /&gt;
&lt;br /&gt;
Kai paleisi šią programą, ji suveiks ir terminale atsiras užrašas:&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli!&lt;br /&gt;
&lt;br /&gt;
==== Alternatyvus būdas: Programavimas paprastu teksto redaktoriumi ====&lt;br /&gt;
&lt;br /&gt;
Jeigu kodo redaktoriaus negali įsidiegti savo kompiuteryje dėl kokių nors priežasčių, programuoti galima ir tiesiog paprasčiausiu teksto redaktoriumi, pvz., Notepad.  &lt;br /&gt;
&lt;br /&gt;
Tiesiog sukurk naują paprastą tekstinį failą (.txt), jame įrašyk programinį kodą &amp;lt;code&amp;gt;print(&amp;quot;Labas, Pasauli!&amp;quot;)&amp;lt;/code&amp;gt;, failą išsaugok pavadinimu &amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
Dabar parašytą programą paleisk vykdyti, tiesiog konsolėje parašęs &amp;lt;code&amp;gt;python3 hello.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tavo programa parašys: &lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli!&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
=== Eime toliau ===&lt;br /&gt;
&lt;br /&gt;
Labai rekomenduojame kiekvieną programos pavyzdį pasibandyti pačiam - parašyk ir tada pasileisk programą. Mūsų praktikoje toks mokymosi procesas yra pats efektyviausias ir veiksmingiausias.&lt;br /&gt;
&lt;br /&gt;
Na, o dabar keliaukime prie kiek sudėtingesnės programos pavyzdžio:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;)&lt;br /&gt;
print(&amp;quot;Parsinešti puodą vandens.&amp;quot;)&lt;br /&gt;
print(&amp;quot;Benas nukrito ir susidaužė karūną,&amp;quot;)&lt;br /&gt;
print(&amp;quot;Ir Liepa suklupo taip pat.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kai paleidi šią programą, ji parašo trumpą istoriją:&lt;br /&gt;
&lt;br /&gt;
 Benas ir Liepa lipo į kalną&lt;br /&gt;
 Parsinešti puodą vandens.&lt;br /&gt;
 Benas nukrito ir susidaužė karūną, &lt;br /&gt;
 Ir Liepa suklupo taip pat.&lt;br /&gt;
&lt;br /&gt;
Kai kompiuteris paleidžia programą, pirmiausia jis mato:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Todėl kompiuteris užrašo:&lt;br /&gt;
&lt;br /&gt;
 Benas ir Liepa lipo į kalną&lt;br /&gt;
&lt;br /&gt;
Tada kompiuteris skaito kitą eilutę ir mato:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Parsinešti puodą vandens.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Todėl ir ją užrašo kompiuterio ekrane:&lt;br /&gt;
&lt;br /&gt;
 Parsinešti puodą vandens.&lt;br /&gt;
&lt;br /&gt;
Taip kompiuteris žiūri į kiekvieną eilutę *iš eilės*, ir ją įvykdęs ir eina toliau: skaito kitą eilutę, ją įvykdo ir t.t. Taip kompiuteris vykdo visas surašytas komandas, kol pasiekia programos pabaigą.&lt;br /&gt;
&lt;br /&gt;
==== Terminologija ====&lt;br /&gt;
Taigi pats laikas truputį paaiškinti, kas vyksta ir trumpai supažindinti su terminologija.&lt;br /&gt;
&lt;br /&gt;
Prieš tai rašydami kodą, mes naudojame „funkciją“ pavadinimu &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt;. Po funkcijos pavadinimo &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; rašomi skliausteliai &amp;lt;code&amp;gt;()&amp;lt;/code&amp;gt;, kuriuose nurodome tos funkcijos parametrus/argumentus. Pažiūrėk į pavyzdį:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
funkcijai duodamas vienas parametras, kuris yra &amp;lt;code&amp;gt;&amp;quot;Labas, Pasauli!&amp;quot;&amp;lt;/code&amp;gt;. Ar pastebėjai, kad šis parametras, sudarytas iš simbolių grupės, kuri įrašyta tarp dviejų kabučių (&amp;quot;&amp;quot;)? Programuotojai tai vadina „rašytinių simbolių seka“ ar trumpiau tariant „eilute“ (tekstine reikšme). Kitas tekstinės reikšmės pavyzdys yra &amp;lt;code&amp;gt;&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Užrašyta funkcija su argumentais yra „teiginys“, kurį supranta Python'as. Sakinio pavyzdys:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paprasčiau tariant, teiginį gali įsivaizduoti kaip vieną programos eilutę.  &lt;br /&gt;
&lt;br /&gt;
Kol kas terminologijos pakaks, keliaujam į kitą poskyrį ir mokomės toliau.&lt;br /&gt;
&lt;br /&gt;
====\n rašyme====&lt;br /&gt;
&amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt;, arba nauja eilutė. Rašant tekstą, visas tekstas po \n yra užrašomas naujoje eilutėje. Taip pat &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; gali būti naudojamas kaip „pabėgimo simbolis“ (escape character). Pabandyk suprasti šią programą:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!\nKą turėčiau daryti?&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kurios rezultatas yra toks:&lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli! &lt;br /&gt;
 Ką turėčiau daryti?&lt;br /&gt;
&lt;br /&gt;
Taip pat &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; naudojamas, kai norime tekstą perkelti į kitą eilutę, bet nenorime naudoti kelių &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt; komandų.&lt;br /&gt;
&lt;br /&gt;
Be to, spausdinimo teiginys automatiškai naudoja &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt;, net jeigu pats &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; ir neužrašai. Paprasčiau suprasti bus pamačius pavyzdį:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iš tikrųjų yra:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!\n&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Išraiškos ===&lt;br /&gt;
Programos pavyzdys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;2 + 2 yra&amp;quot;, 2 + 2)&lt;br /&gt;
print(&amp;quot;3 * 4 yra&amp;quot;, 3 * 4)&lt;br /&gt;
print(&amp;quot;100 - 1 yra&amp;quot;, 100 - 1)&lt;br /&gt;
print(&amp;quot;((33 + 2) / 5 + 11.5 yra&amp;quot;, (33 + 2) / 5 + 11.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 2 + 2 yra 4&lt;br /&gt;
 3 * 4 yra 12&lt;br /&gt;
 100 - 1 yra 99&lt;br /&gt;
 (33 + 2) / 5 + 11.5 yra 18.5&lt;br /&gt;
&lt;br /&gt;
==== Aritmetinės išraiškos ====&lt;br /&gt;
&lt;br /&gt;
Šiame pavyzdyje, rašymo funkcija &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt; yra su dvejais argumentais, kurie atskirti kableliu. Taigi pirmoje programos eilutėje&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;2 + 2 yra&amp;quot;, 2 + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pirmas argumentas yra teksto eilutė &amp;lt;code&amp;gt;&amp;quot;2 + 2 yra&amp;quot;&amp;lt;/code&amp;gt; ir antras argumentas yra aritmetinė išraiška &amp;lt;code&amp;gt;2 + 2&amp;lt;/code&amp;gt;, tiksliau tariant viena iš aritmetinių išraiškų.&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad eilutė, kuri yra užrašyta kabutėse yra atspausdinama kaip tekstas, o išraiška užrašyta be kabučių yra apskaičiuojama ir užrašomas atsakymas.&lt;br /&gt;
&lt;br /&gt;
Python'o programavimo kalba turi septynias pagrindines skaičių operacijas.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Operacija &lt;br /&gt;
! Simbolis &lt;br /&gt;
! Pavyzdys&lt;br /&gt;
|-&lt;br /&gt;
|Kėlimas laipsniu  &lt;br /&gt;
| &amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;5 ** 2 == 25&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Daugyba &lt;br /&gt;
| &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; &lt;br /&gt;
|&amp;lt;code&amp;gt;2 * 3 == 6&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Dalyba &lt;br /&gt;
| &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;14 / 3 == 4.666666666666667&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Sveikųjų skaičių dalyba&lt;br /&gt;
| &amp;lt;code&amp;gt;//&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;14 // 3 == 4&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Liekana (modulis)&lt;br /&gt;
| &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;14 % 3 == 2&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Sudėtis&lt;br /&gt;
| &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;1 + 2 == 3&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Atimtis &lt;br /&gt;
| &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;4 - 3 == 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad yra du dalybos būdai: vienas grąžina pasikartojantį dešimtainį skaičių, o kitas - liekaną ir visą skaičių.&lt;br /&gt;
Operacijų tvarka tokia pati kaip matematikoje:&lt;br /&gt;
* skliausteliuose &amp;lt;code&amp;gt;()&amp;lt;/code&amp;gt;&lt;br /&gt;
* kėlimas laipsniu &amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt;&lt;br /&gt;
* daugyba &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;, dalyba&amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt;, sveikųjų skaičių dalyba &amp;lt;code&amp;gt;//&amp;lt;/code&amp;gt;, dalyba su liekana &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; &lt;br /&gt;
* sudėtis &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; ir atimtis &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taigi, užrašydamas formules, nepamiršk skliaustelių.&lt;br /&gt;
&lt;br /&gt;
=== Komentarai ===&lt;br /&gt;
&lt;br /&gt;
Rašant daug kodo, ateityje tikrai ne viską atsiminsi. Todėl programoje gali naudoti komentarus, kurie gali būti naudojami kaip pastabos/paaiškinimai tau arba kitiems programuotojams. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Skaičiaus PI išraiška kompiuterio ekrane&lt;br /&gt;
print(22 / 7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas: &lt;br /&gt;
&lt;br /&gt;
 3.14285714286&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad komentaras prasideda grotelių ženklu: &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. Komentarai yra naudojami ateičiai arba kitiems žmonėms, kurie skaito programą. &lt;br /&gt;
&lt;br /&gt;
Taip pat svarbu suprasti, kad po &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; galima naudoti bet kokius ženklus ir kompiuteris šio teksto nepaisys tol, kol atsiras tekstas naujos eilutės pradžioje.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Skaičiaus PI išraiška kompiuterio ekrane&lt;br /&gt;
print(22/7) # Jeigu būtume preciziškai tikslūs, tai čia gauname tik apytikslią PI reikšmę&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pavyzdžiai ===&lt;br /&gt;
Kiekvieno skyriaus gale bus pateikiami su skyriaus tema susiję pavyzdžiai. Turėtum juos peržvelgti ir išsiaiškinti ar supratai. Taip pat juos gali įsikelti į python kodo redaktorių ir pažiūrėti kaip viekia. Jeigu suprasi, keliauk toliau, jeigu ne, bandyk dar kartą perskaityti skyriaus medžiagą ir suprasti pavyzdžių logiką.&lt;br /&gt;
&lt;br /&gt;
'''Danija.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Būti ar nebūti, štai kur klausimas.&amp;quot;)&lt;br /&gt;
print(&amp;quot;                -- Šekspyras&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Būti ar nebūti, štai kur klausimas.&lt;br /&gt;
                 -- Šekspyras&lt;br /&gt;
&lt;br /&gt;
'''Mokykla.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Pirmoji klasė&amp;quot;)&lt;br /&gt;
print(&amp;quot;1 + 1 =&amp;quot;, 1 + 1)&lt;br /&gt;
print(&amp;quot;2 + 4 =&amp;quot;, 2 + 4)&lt;br /&gt;
print(&amp;quot;5 - 2 =&amp;quot;, 5 - 2)&lt;br /&gt;
print()&lt;br /&gt;
print(&amp;quot;Trečioji klasė&amp;quot;)&lt;br /&gt;
print(&amp;quot;243 - 23 =&amp;quot;, 243 - 23)&lt;br /&gt;
print(&amp;quot;12 * 4 =&amp;quot;, 12 * 4)&lt;br /&gt;
print(&amp;quot;12 / 3 =&amp;quot;, 12 / 3)&lt;br /&gt;
print(&amp;quot;13 / 3 =&amp;quot;, 13 // 3, &amp;quot;R&amp;quot;, 13 % 3)&lt;br /&gt;
print()&lt;br /&gt;
print(&amp;quot;Vidurinė&amp;quot;)&lt;br /&gt;
print(&amp;quot;123.56 - 62.12 =&amp;quot;, 123.56 - 62.12)&lt;br /&gt;
print(&amp;quot;(4 + 3) * 2 =&amp;quot;, (4 + 3) * 2)&lt;br /&gt;
print(&amp;quot;4 + 3 * 2 =&amp;quot;, 4 + 3 * 2)&lt;br /&gt;
print(&amp;quot;3 ** 2 =&amp;quot;, 3 ** 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Pirma klasė&lt;br /&gt;
 1 + 1 = 2&lt;br /&gt;
 2 + 4 = 6&lt;br /&gt;
 5 - 2 = 3&lt;br /&gt;
 &lt;br /&gt;
 Trečia klasė&lt;br /&gt;
 243 - 23 = 220&lt;br /&gt;
 12 * 4 = 48&lt;br /&gt;
 12 / 3 = 4&lt;br /&gt;
 13 / 3 = 4 R 1&lt;br /&gt;
 &lt;br /&gt;
 Vidurinė&lt;br /&gt;
 123.56 - 62.12 = 61.44&lt;br /&gt;
 (4 + 3) * 2 = 14&lt;br /&gt;
 4 + 3 * 2 = 10&lt;br /&gt;
 3 ** 2 = 9&lt;br /&gt;
&lt;br /&gt;
=== Pratimai ===&lt;br /&gt;
&lt;br /&gt;
# Parašyk programą, kuri atspausdintų tavo vardą ir gimimo datą atskirose eilutėse&lt;br /&gt;
# Parašyk programą, kuri parodytų visų 7 [[#Aritmetinės_išraiškos|artimetinių operacijų]] panaudojimą.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;mw-collapsible mw-collapsed wikitable&amp;quot;&lt;br /&gt;
! colspan=2 | Sprendimas #1 &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
1. Parašyk programą, kuri atspausdintų tavo vardą ir gimimo datą atskirose eilutėse&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Ada Lovelace&amp;quot;, &amp;quot;gimusi&amp;quot;, &amp;quot;lapkričio 27, 1852&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Albertas Einšteinas&amp;quot;, &amp;quot;gimęs&amp;quot;, &amp;quot;14 kovo 1879&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print((&amp;quot;Jonas Smitas&amp;quot;), (&amp;quot;gimęs&amp;quot;), (&amp;quot;14 kovo 1879&amp;quot;))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;mw-collapsible mw-collapsed wikitable&amp;quot;&lt;br /&gt;
! colspan=2 | Sprendimas #2 &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
2. Parašyk programą, kuri parodytų visų 7 [[#Aritmetinės_išraiškos|artimetinių operacijų]] panaudojimą.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;5**5 = &amp;quot;, 5**5)&lt;br /&gt;
print(&amp;quot;6*7 = &amp;quot;, 6*7)&lt;br /&gt;
print(&amp;quot;56/8 = &amp;quot;, 56/8)&lt;br /&gt;
print(&amp;quot;14//6 = &amp;quot;, 14//6)&lt;br /&gt;
print(&amp;quot;14%6 = &amp;quot;, 14%6)&lt;br /&gt;
print(&amp;quot;5+6 = &amp;quot;, 5+6)&lt;br /&gt;
print(&amp;quot;9-0 = &amp;quot;, 9-0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Išnašos====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Įvadas |next=Kas čia eina?}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Labas,_Pasauli&amp;diff=3748</id>
		<title>Python Vadovėlis/Labas, Pasauli</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Labas,_Pasauli&amp;diff=3748"/>
		<updated>2022-01-04T15:49:00Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Now for our first lesson, what is a computer program?  A computer program is a set of very detailed instructions that tell a computer what to do.   --&amp;gt;&lt;br /&gt;
=== Ką sužinosi? ===&lt;br /&gt;
Perskaitęs šį skyrių, turėtum suprasti kaip teksto redaktoriumi rašyti programas, kaip parašytas programas išsaugoti kompiuterio atmintyje ir kaip jas paleisti.&lt;br /&gt;
&lt;br /&gt;
=== Spausdinimas ===&lt;br /&gt;
Istoriškai taip jau susiklostė, kad programavimo pamokos dažniausiai prasideda nuo mažos ir paprastos programėlės pavadinimu „Hello, World!“ arba lietuviškai [[„Labas, Pasauli!“]].&lt;br /&gt;
&lt;br /&gt;
Python'o programavimo kalboje programa atrodytų taip: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Programavimas kodo redaktoriumi ====&lt;br /&gt;
&lt;br /&gt;
Programavimui rekomenduojame naudoti kodo redaktorių &amp;lt;code&amp;gt;LR NŠA Python&amp;lt;/code&amp;gt;, kaip aprašytą skyriuje [[Non-Programmer's Tutorial for Python 3/Intro#Creating_and_Running_Programs|Programų kūrimas ir paleidimas]]. Savo kompiuteryje atsidaryk šią programavimo aplinką, sukurk naują failą (File -&amp;gt; New File), įkopijuok šį kodą ir tuomet failą išsaugok (File -&amp;gt; Save) pavadinimu &amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
Sveikiname! Sukūrei savo pirmą Python programą.&lt;br /&gt;
&lt;br /&gt;
(Jeigu tokios programavimo aplinkos įsidiegti savo kompiuteryje negali, žr. kitą žingsnį).&lt;br /&gt;
&lt;br /&gt;
Dabar parašytą programą paleisk vykdyti: tiesiog paspausk žalią mygtuką dešinėje viršuje.&lt;br /&gt;
&lt;br /&gt;
Kai paleisi šią programą, ji suveiks ir terminale atsiras užrašas:&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli!&lt;br /&gt;
&lt;br /&gt;
==== Alternatyvus būdas: Programavimas paprastu teksto redaktoriumi ====&lt;br /&gt;
&lt;br /&gt;
Jeigu kodo redaktoriaus negali įsidiegti savo kompiuteryje dėl kokių nors priežasčių, programuoti galima ir tiesiog paprasčiausiu teksto redaktoriumi, pvz., Notepad.  &lt;br /&gt;
&lt;br /&gt;
Tiesiog sukurk naują paprastą tekstinį failą (.txt), jame įrašyk programinį kodą &amp;lt;code&amp;gt;print(&amp;quot;Labas, Pasauli!&amp;quot;)&amp;lt;/code&amp;gt;, failą išsaugok pavadinimu &amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
Dabar parašytą programą paleisk vykdyti, tiesiog konsolėje parašęs &amp;lt;code&amp;gt;python3 hello.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tavo programa parašys: &lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli!&lt;br /&gt;
&lt;br /&gt;
TODO: gif&lt;br /&gt;
&lt;br /&gt;
=== Eime toliau ===&lt;br /&gt;
&lt;br /&gt;
Labai rekomenduojame kiekvieną programos pavyzdį pasibandyti pačiam - parašyk ir tada pasileisk programą. Mūsų praktikoje toks mokymosi procesas yra pats efektyviausias ir veiksmingiausias.&lt;br /&gt;
&lt;br /&gt;
Na, o dabar keliaukime prie kiek sudėtingesnės programos pavyzdžio:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;)&lt;br /&gt;
print(&amp;quot;Parsinešti puodą vandens.&amp;quot;)&lt;br /&gt;
print(&amp;quot;Benas nukrito ir susidaužė karūną,&amp;quot;)&lt;br /&gt;
print(&amp;quot;Ir Liepa suklupo taip pat.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kai paleidi šią programą, ji parašo trumpą istoriją:&lt;br /&gt;
&lt;br /&gt;
 Benas ir Liepa lipo į kalną&lt;br /&gt;
 Parsinešti puodą vandens.&lt;br /&gt;
 Benas nukrito ir susidaužė karūną, &lt;br /&gt;
 Ir Liepa suklupo taip pat.&lt;br /&gt;
&lt;br /&gt;
Kai kompiuteris paleidžia programą, pirmiausia jis mato:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Todėl kompiuteris užrašo:&lt;br /&gt;
&lt;br /&gt;
 Benas ir Liepa lipo į kalną&lt;br /&gt;
&lt;br /&gt;
Tada kompiuteris skaito kitą eilutę ir mato:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Parsinešti puodą vandens.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Todėl ir ją užrašo kompiuterio ekrane:&lt;br /&gt;
&lt;br /&gt;
 Parsinešti puodą vandens.&lt;br /&gt;
&lt;br /&gt;
Taip kompiuteris žiūri į kiekvieną eilutę *iš eilės*, ir ją įvykdęs ir eina toliau: skaito kitą eilutę, ją įvykdo ir t.t. Taip kompiuteris vykdo visas surašytas komandas, kol pasiekia programos pabaigą.&lt;br /&gt;
&lt;br /&gt;
==== Terminologija ====&lt;br /&gt;
Taigi pats laikas truputį paaiškinti, kas vyksta ir trumpai supažindinti su terminologija.&lt;br /&gt;
&lt;br /&gt;
Prieš tai rašydami kodą, mes naudojame „funkciją“ pavadinimu &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt;. Po funkcijos pavadinimo &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; rašomi skliausteliai &amp;lt;code&amp;gt;()&amp;lt;/code&amp;gt;, kuriuose nurodome tos funkcijos parametrus/argumentus. Pažiūrėk į pavyzdį:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
funkcijai duodamas vienas parametras, kuris yra &amp;lt;code&amp;gt;&amp;quot;Labas, Pasauli!&amp;quot;&amp;lt;/code&amp;gt;. Ar pastebėjai, kad šis parametras, sudarytas iš simbolių grupės, kuri įrašyta tarp dviejų kabučių (&amp;quot;&amp;quot;)? Programuotojai tai vadina „rašytinių simbolių seka“ ar trumpiau tariant „eilute“ (tekstine reikšme). Kitas tekstinės reikšmės pavyzdys yra &amp;lt;code&amp;gt;&amp;quot;Benas ir Liepa lipo į kalną&amp;quot;&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Užrašyta funkcija su argumentais yra „teiginys“, kurį supranta Python'as. Sakinio pavyzdys:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paprasčiau tariant, teiginį gali įsivaizduoti kaip vieną programos eilutę.  &lt;br /&gt;
&lt;br /&gt;
Kol kas terminologijos pakaks, keliaujam į kitą poskyrį ir mokomės toliau.&lt;br /&gt;
&lt;br /&gt;
====\n rašyme====&lt;br /&gt;
&amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt;, arba nauja eilutė. Rašant tekstą, visas tekstas po \n yra užrašomas naujoje eilutėje. Taip pat &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; gali būti naudojamas kaip „pabėgimo simbolis“ (escape character). Pabandyk suprasti šią programą:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!\nKą turėčiau daryti?&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Kurios rezultatas yra toks:&lt;br /&gt;
&lt;br /&gt;
 Labas, Pasauli! &lt;br /&gt;
 Ką turėčiau daryti?&lt;br /&gt;
&lt;br /&gt;
Taip pat &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; naudojamas, kai norime tekstą perkelti į kitą eilutę, bet nenorime naudoti kelių &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt; komandų.&lt;br /&gt;
&lt;br /&gt;
Be to, spausdinimo teiginys automatiškai naudoja &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt;, net jeigu pats &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; ir neužrašai. Paprasčiau suprasti bus pamačius pavyzdį:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
iš tikrųjų yra:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Labas, Pasauli!\n&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Išraiškos ===&lt;br /&gt;
Programos pavyzdys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;2 + 2 yra&amp;quot;, 2 + 2)&lt;br /&gt;
print(&amp;quot;3 * 4 yra&amp;quot;, 3 * 4)&lt;br /&gt;
print(&amp;quot;100 - 1 yra&amp;quot;, 100 - 1)&lt;br /&gt;
print(&amp;quot;((33 + 2) / 5 + 11.5 yra&amp;quot;, (33 + 2) / 5 + 11.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 2 + 2 yra 4&lt;br /&gt;
 3 * 4 yra 12&lt;br /&gt;
 100 - 1 yra 99&lt;br /&gt;
 (33 + 2) / 5 + 11.5 yra 18.5&lt;br /&gt;
&lt;br /&gt;
==== Aritmetinės išraiškos ====&lt;br /&gt;
&lt;br /&gt;
Šiame pavyzdyje, &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt;(rašymo) funkcija yra su dvejais argumentais, kurie yra atskirti kableliu. Taigi pirmoje programos eilutėje&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;2 + 2 yra&amp;quot;, 2 + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pirmas argumentas yra teksto eilutė &amp;lt;code&amp;gt;&amp;quot;2 + 2 yra&amp;quot;&amp;lt;/code&amp;gt; ir antras argumentas yra aritmetinė išraiška &amp;lt;code&amp;gt;2 + 2&amp;lt;/code&amp;gt;, tiksliau tariant viena iš aritmetinių išraiškų.&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad eilutė, kuri yra užrašyta kabutėse yra atspausdinama kaip tekstas, o išraiška užrašyta be kabučių yra apskaičiuojama ir užrašomas atsakymas.&lt;br /&gt;
&lt;br /&gt;
Python'o programavimo kalba turi septynias pagrindines skaičių operacijas.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Operacija &lt;br /&gt;
! Simbolis &lt;br /&gt;
! Pavyzdys&lt;br /&gt;
|-&lt;br /&gt;
|Kėlimas laipsniu (exponentiation)&lt;br /&gt;
| &amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;5 ** 2 == 25&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Daugyba &lt;br /&gt;
| &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; &lt;br /&gt;
|&amp;lt;code&amp;gt;2 * 3 == 6&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Dalyba &lt;br /&gt;
| &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;14 / 3 == 4.666666666666667&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Sveikųjų skaičių dalyba&lt;br /&gt;
| &amp;lt;code&amp;gt;//&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;14 // 3 == 4&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Liekana (modulis)&lt;br /&gt;
| &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;14 % 3 == 2&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Sudėtis&lt;br /&gt;
| &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;1 + 2 == 3&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Atimtis &lt;br /&gt;
| &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;4 - 3 == 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad yra du dalybos būdai: vienas grąžina pasikartojantį dešimtainį skaičių, o kitas - liekaną ir visą skaičių.&lt;br /&gt;
Operacijų tvarka tokia pati kaip matematikoje:&lt;br /&gt;
* skliausteliuose &amp;lt;code&amp;gt;()&amp;lt;/code&amp;gt;&lt;br /&gt;
* rodikliai &amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt;&lt;br /&gt;
* daugyba &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;, dalyba&amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt;, sveikųjų skaičių dalyba &amp;lt;code&amp;gt;//&amp;lt;/code&amp;gt;, dalyba su liekana &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; &lt;br /&gt;
* sudėtis &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; ir atimtis &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taigi naudok skliaustelius užrašydamas formules.&lt;br /&gt;
&lt;br /&gt;
=== Komentarai ===&lt;br /&gt;
&lt;br /&gt;
Rašant daug kodo, ateityje tikrai ne viską atsiminsi. Todėl programoje gali naudoti komentarus, kurie gali būti naudojami kaip pastabos/paaiškinimai tau arba kitiems programuotojams. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Skaičiaus PI išraiška kompiuterio ekrane&lt;br /&gt;
print(22 / 7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas: &lt;br /&gt;
&lt;br /&gt;
 3.14285714286&lt;br /&gt;
&lt;br /&gt;
Atkreipk dėmesį, kad komentaras prasideda grotelių ženklu: &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. Komentarai yra naudojami ateičiai arba kitiems žmonėms, kurie skaito programą. &lt;br /&gt;
&lt;br /&gt;
Taip pat svarbu suprasti, kad po &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; galima naudoti bet kokius ženklus ir kompiuteris šio teksto nepaisys tol, kol atsiras tekstas naujos eilutės pradžioje.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Skaičiaus PI išraiška kompiuterio ekrane&lt;br /&gt;
print(22/7) # Jeigu būtume preciziškai tikslūs, tai čia gauname tik apytikslią PI reikšmę&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pavyzdžiai ===&lt;br /&gt;
Kiekvieno skyriaus gale bus pateikiami su skyriaus tema susiję pavyzdžiai. Turėtum juos peržvelgti ir išsiaiškinti ar supratai. Taip pat juos gali įsikelti į python kodo redaktorių ir pažiūrėti kaip viekia. Jeigu suprasi, keliauk toliau, jeigu ne, bandyk dar kartą perskaityti skyriaus medžiagą ir suprasti pavyzdžių logiką.&lt;br /&gt;
&lt;br /&gt;
'''Danija.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Būti ar nebūti, štai kur klausimas.&amp;quot;)&lt;br /&gt;
print(&amp;quot;                -- Šekspyras&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Būti ar nebūti, štai kur klausimas.&lt;br /&gt;
                 -- Šekspyras&lt;br /&gt;
&lt;br /&gt;
'''Mokykla.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Pirmoji klasė&amp;quot;)&lt;br /&gt;
print(&amp;quot;1 + 1 =&amp;quot;, 1 + 1)&lt;br /&gt;
print(&amp;quot;2 + 4 =&amp;quot;, 2 + 4)&lt;br /&gt;
print(&amp;quot;5 - 2 =&amp;quot;, 5 - 2)&lt;br /&gt;
print()&lt;br /&gt;
print(&amp;quot;Trečioji klasė&amp;quot;)&lt;br /&gt;
print(&amp;quot;243 - 23 =&amp;quot;, 243 - 23)&lt;br /&gt;
print(&amp;quot;12 * 4 =&amp;quot;, 12 * 4)&lt;br /&gt;
print(&amp;quot;12 / 3 =&amp;quot;, 12 / 3)&lt;br /&gt;
print(&amp;quot;13 / 3 =&amp;quot;, 13 // 3, &amp;quot;R&amp;quot;, 13 % 3)&lt;br /&gt;
print()&lt;br /&gt;
print(&amp;quot;Vidurinė&amp;quot;)&lt;br /&gt;
print(&amp;quot;123.56 - 62.12 =&amp;quot;, 123.56 - 62.12)&lt;br /&gt;
print(&amp;quot;(4 + 3) * 2 =&amp;quot;, (4 + 3) * 2)&lt;br /&gt;
print(&amp;quot;4 + 3 * 2 =&amp;quot;, 4 + 3 * 2)&lt;br /&gt;
print(&amp;quot;3 ** 2 =&amp;quot;, 3 ** 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&lt;br /&gt;
&lt;br /&gt;
 Pirma klasė&lt;br /&gt;
 1 + 1 = 2&lt;br /&gt;
 2 + 4 = 6&lt;br /&gt;
 5 - 2 = 3&lt;br /&gt;
 &lt;br /&gt;
 Trečia klasė&lt;br /&gt;
 243 - 23 = 220&lt;br /&gt;
 12 * 4 = 48&lt;br /&gt;
 12 / 3 = 4&lt;br /&gt;
 13 / 3 = 4 R 1&lt;br /&gt;
 &lt;br /&gt;
 Vidurinė&lt;br /&gt;
 123.56 - 62.12 = 61.44&lt;br /&gt;
 (4 + 3) * 2 = 14&lt;br /&gt;
 4 + 3 * 2 = 10&lt;br /&gt;
 3 ** 2 = 9&lt;br /&gt;
&lt;br /&gt;
=== Pratimai ===&lt;br /&gt;
&lt;br /&gt;
# Parašyk programą, kuri atspausdintų tavo vardą ir gimimo datą atskirose eilutėse&lt;br /&gt;
# Parašyk programą, kuri parodytų visų 7 [[#Aritmetinės_išraiškos|artimetinių operacijų]] panaudojimą.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;mw-collapsible mw-collapsed wikitable&amp;quot;&lt;br /&gt;
! colspan=2 | Sprendimas #1 &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
1. Parašyk programą, kuri atspausdintų tavo vardą ir gimimo datą atskirose eilutėse&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Ada Lovelace&amp;quot;, &amp;quot;gimusi&amp;quot;, &amp;quot;lapkričio 27, 1852&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Albertas Einšteinas&amp;quot;, &amp;quot;gimęs&amp;quot;, &amp;quot;14 kovo 1879&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print((&amp;quot;Jonas Smitas&amp;quot;), (&amp;quot;gimęs&amp;quot;), (&amp;quot;14 kovo 1879&amp;quot;))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;mw-collapsible mw-collapsed wikitable&amp;quot;&lt;br /&gt;
! colspan=2 | Sprendimas #2 &amp;amp;nbsp;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
2. Parašyk programą, kuri parodytų visų 7 [[#Aritmetinės_išraiškos|artimetinių operacijų]] panaudojimą.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;5**5 = &amp;quot;, 5**5)&lt;br /&gt;
print(&amp;quot;6*7 = &amp;quot;, 6*7)&lt;br /&gt;
print(&amp;quot;56/8 = &amp;quot;, 56/8)&lt;br /&gt;
print(&amp;quot;14//6 = &amp;quot;, 14//6)&lt;br /&gt;
print(&amp;quot;14%6 = &amp;quot;, 14%6)&lt;br /&gt;
print(&amp;quot;5+6 = &amp;quot;, 5+6)&lt;br /&gt;
print(&amp;quot;9-0 = &amp;quot;, 9-0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Išnašos====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Įvadas |next=Kas čia eina?}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AE%C5%BEanga&amp;diff=3747</id>
		<title>Python Vadovėlis/Įžanga</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AE%C5%BEanga&amp;diff=3747"/>
		<updated>2022-01-04T08:53:15Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Visi pavyzdiniai Python kodai šiame vadovėlyje yra skirti viešam naudojimui (angl. public domain). Jūs galite bet kaip keisti ir platinti modifikuotus kodus, bet kokia norima licencija (nebūtinai Creative Commons Attribution-ShareAlike).  &lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis sukurtas knygos &amp;quot;Non-Programmer's Tutorial for Python&amp;quot; pagrindu. Panašūs vertimai sukurti anglų, korėjiečių, ispanų, italų, graikų ir kitomis kalbomis, žr. [http://jjc.freeshell.org/easytut/ http://jjc.freeshell.org/easytut/]  &lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis yra įvadas į Python programavimo kalbą, ir skirtas tiems, kas dar neturi jokios programavimo patirties.  &lt;br /&gt;
&lt;br /&gt;
Tokiu atveju, jeigu jau esi programavęs kokia nors kita programavimo kalba, vietoje šio vadovėlio siūlau kitą resursą - [https://docs.python.org/3/tutorial/index.html Python Tutorial for Programmers], kurį parašė Gvidas van Rosumas (Guido van Rossum).  &lt;br /&gt;
&lt;br /&gt;
Jei turi klausimų ar komentarų, naudokis šio portalo diskusijų puslapiais, arba susisiek su autoriais. Visi klausimai ir pasiūlymai labai laukiami. Bandysime atsakyti kai įmanoma geriau.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Kiti resursų puslapiai ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.python.org Python Home Page]&lt;br /&gt;
* [https://docs.python.org/3/ Python 3 Documentation]&lt;br /&gt;
* [http://www.swaroopch.com/notes/python A Byte of Python by Swaroop C H]&lt;br /&gt;
* [http://python3porting.com/ Porting to Python 3: An in-depth guide]&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Autoriai|next=Įvadas}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=MediaWiki:Global.css&amp;diff=3716</id>
		<title>MediaWiki:Global.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=MediaWiki:Global.css&amp;diff=3716"/>
		<updated>2021-12-17T15:43:46Z</updated>

		<summary type="html">&lt;p&gt;Mantas: Naujas puslapis: body { 	background: #f8f8fb; }  #mw-head { 	background: #615dfa;     color: white; 	min-height: 80px; }  #mw-head a { 	color: white; }  #mw-head .vector-menu-tabs li.selected {...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;body {&lt;br /&gt;
	background: #f8f8fb;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
    color: white;&lt;br /&gt;
	min-height: 80px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head a {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs li.selected {&lt;br /&gt;
	background: #5653df;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs li {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs .selected a, .vector-menu-tabs .selected a:visited {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs .new a, .vector-menu-tabs .new a:visited {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs li a {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head  .vector-menu-tabs, #mw-head .vector-menu-tabs a, #mw-head .vector-menu-dropdown h3 {&lt;br /&gt;
    background-image: -webkit-gradient(linear,left top, left bottom,color-stop(0, rgba(167,215,249,0)),to(#1d2333));&lt;br /&gt;
    background-image: -o-linear-gradient(top,rgba(167,215,249,0) 0,#1d2333 100%);&lt;br /&gt;
    background-image: linear-gradient(to bottom,rgba(167,215,249,0) 0,#1d2333 100%);&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mv-head .vector-menu-dropdown h3 {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mv-head .menu .vector-menu-content-list {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vector-menu-dropdown .vector-menu-content-list {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vector-menu-dropdown .vector-menu-checkbox:checked ~ .vector-menu-content .vector-menu-content-list {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
	border-bottom-right-radius: 5px;&lt;br /&gt;
    border-bottom-left-radius: 5px;&lt;br /&gt;
    border: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-panel {&lt;br /&gt;
    border-radius: 12px;&lt;br /&gt;
    width: 176px;&lt;br /&gt;
    border-top-right-radius: 0;&lt;br /&gt;
    border-top-left-radius: 0;&lt;br /&gt;
    -webkit-box-shadow: 0px 1px 1px 0px #bfbfbf;&lt;br /&gt;
    box-shadow: 0px 1px 1px 0px #bfbfbf;&lt;br /&gt;
    padding: 27px;&lt;br /&gt;
    background: white;&lt;br /&gt;
    margin-top: 80px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#content {&lt;br /&gt;
	padding: 32px 28px;&lt;br /&gt;
    border-radius: 12px;&lt;br /&gt;
    background-color: white;&lt;br /&gt;
    -webkit-box-shadow: 0 0 40px 0 rgb(94 92 154 / 6%);&lt;br /&gt;
    box-shadow: 0 0 40px 0 rgb(94 92 154 / 6%);&lt;br /&gt;
    position: relative;&lt;br /&gt;
    max-width: 50em;&lt;br /&gt;
    margin-top: 25px;&lt;br /&gt;
	border: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#searchInput::-webkit-input-placeholder {&lt;br /&gt;
	color: #fbfbfb;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#searchInput {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body h1, .mw-body-content h1, .mw-body-content h2 {&lt;br /&gt;
	font-family: Rajdhani,sans-serif;&lt;br /&gt;
	border: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen and (min-width: 1366px) {&lt;br /&gt;
  #content {&lt;br /&gt;
	margin-left: auto;&lt;br /&gt;
	margin-right: auto;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  #footer {&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin-left: auto;&lt;br /&gt;
	margin-right: auto;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen and (min-width: 769px) and (max-width: 1365px) {&lt;br /&gt;
  #content {&lt;br /&gt;
	margin-left: 255px;&lt;br /&gt;
    margin-right: 25px;&lt;br /&gt;
  }&lt;br /&gt;
  #footer {&lt;br /&gt;
	margin-left: 255px;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen and (max-width: 768px) {&lt;br /&gt;
	#mw-panel {&lt;br /&gt;
		width: 10em;&lt;br /&gt;
		padding: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=MediaWiki:Common.css&amp;diff=3715</id>
		<title>MediaWiki:Common.css</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=MediaWiki:Common.css&amp;diff=3715"/>
		<updated>2021-12-17T15:21:15Z</updated>

		<summary type="html">&lt;p&gt;Mantas: Naujas puslapis: /** Čia įdėtas CSS bus taikomas visoms išvaizdoms */ body { 	background: #f8f8fb; }  #mw-head { 	background: #615dfa;     color: white; 	min-height: 80px; }  #mw-head a { 	co...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/** Čia įdėtas CSS bus taikomas visoms išvaizdoms */&lt;br /&gt;
body {&lt;br /&gt;
	background: #f8f8fb;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
    color: white;&lt;br /&gt;
	min-height: 80px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head a {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs li.selected {&lt;br /&gt;
	background: #5653df;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs li {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs .selected a, .vector-menu-tabs .selected a:visited {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs .new a, .vector-menu-tabs .new a:visited {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head .vector-menu-tabs li a {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-head  .vector-menu-tabs, #mw-head .vector-menu-tabs a, #mw-head .vector-menu-dropdown h3 {&lt;br /&gt;
    background-image: -webkit-gradient(linear,left top, left bottom,color-stop(0, rgba(167,215,249,0)),to(#1d2333));&lt;br /&gt;
    background-image: -o-linear-gradient(top,rgba(167,215,249,0) 0,#1d2333 100%);&lt;br /&gt;
    background-image: linear-gradient(to bottom,rgba(167,215,249,0) 0,#1d2333 100%);&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mv-head .vector-menu-dropdown h3 {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mv-head .menu .vector-menu-content-list {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vector-menu-dropdown .vector-menu-content-list {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vector-menu-dropdown .vector-menu-checkbox:checked ~ .vector-menu-content .vector-menu-content-list {&lt;br /&gt;
	background: #615dfa;&lt;br /&gt;
	border-bottom-right-radius: 5px;&lt;br /&gt;
    border-bottom-left-radius: 5px;&lt;br /&gt;
    border: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#mw-panel {&lt;br /&gt;
    border-radius: 12px;&lt;br /&gt;
    width: 176px;&lt;br /&gt;
    border-top-right-radius: 0;&lt;br /&gt;
    border-top-left-radius: 0;&lt;br /&gt;
    -webkit-box-shadow: 0px 1px 1px 0px #bfbfbf;&lt;br /&gt;
    box-shadow: 0px 1px 1px 0px #bfbfbf;&lt;br /&gt;
    padding: 27px;&lt;br /&gt;
    background: white;&lt;br /&gt;
    margin-top: 80px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#content {&lt;br /&gt;
	padding: 32px 28px;&lt;br /&gt;
    border-radius: 12px;&lt;br /&gt;
    background-color: white;&lt;br /&gt;
    -webkit-box-shadow: 0 0 40px 0 rgb(94 92 154 / 6%);&lt;br /&gt;
    box-shadow: 0 0 40px 0 rgb(94 92 154 / 6%);&lt;br /&gt;
    position: relative;&lt;br /&gt;
    max-width: 50em;&lt;br /&gt;
    margin-top: 25px;&lt;br /&gt;
	border: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#searchInput::-webkit-input-placeholder {&lt;br /&gt;
	color: #fbfbfb;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#searchInput {&lt;br /&gt;
	color: white;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.mw-body h1, .mw-body-content h1, .mw-body-content h2 {&lt;br /&gt;
	font-family: Rajdhani,sans-serif;&lt;br /&gt;
	border: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen and (min-width: 1366px) {&lt;br /&gt;
  #content {&lt;br /&gt;
	margin-left: auto;&lt;br /&gt;
	margin-right: auto;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  #footer {&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin-left: auto;&lt;br /&gt;
	margin-right: auto;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen and (min-width: 769px) and (max-width: 1365px) {&lt;br /&gt;
  #content {&lt;br /&gt;
	margin-left: 255px;&lt;br /&gt;
    margin-right: 25px;&lt;br /&gt;
  }&lt;br /&gt;
  #footer {&lt;br /&gt;
	margin-left: 255px;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen and (max-width: 768px) {&lt;br /&gt;
	#mw-panel {&lt;br /&gt;
		width: 10em;&lt;br /&gt;
		padding: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Terminai&amp;diff=3080</id>
		<title>Python Vadovėlis/Terminai</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Terminai&amp;diff=3080"/>
		<updated>2021-09-22T12:46:41Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Computer - Kompiuteris  &lt;br /&gt;
Mouse - pelė&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=FAQ |next=END}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/DUK&amp;diff=3079</id>
		<title>Python Vadovėlis/DUK</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/DUK&amp;diff=3079"/>
		<updated>2021-09-22T12:42:27Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;; How do I make a GUI in Python? : You can use one of these library: [https://docs.python.org/3.5/library/tkinter.html TKinter], [https://riverbankcomputing.com/software/pyqt/intro PyQt], [https://wiki.gnome.org/Projects/PyGObject PyGobject]. For really simple graphics, you can use the turtle graphics mode &amp;lt;code&amp;gt;import turtle&amp;lt;/code&amp;gt;&lt;br /&gt;
; How do I make a game in Python? : The best method is probably to use PyGame at http://pygame.org/&lt;br /&gt;
; How do I make an executable from a Python program? : Short answer: Python is an interepreted language so that is impossible. Long answer is that something similar to an executable can be created by taking the Python interpreter and the file and joining them together and distributing that.  For more on that problem see http://www.python.org/doc/faq/programming/#how-can-i-create-a-stand-alone-binary-from-a-python-script&lt;br /&gt;
; (IFAQ) Why do you use first person in this tutorial? : Once upon a time in a different millennia, (1999 to be exact), an earlier version was written entirely by Josh Cogliati, and it was up on his webpage http://www.honors.montana.edu/~jjc/easytut and it was good.  Then the server rupert, like all good things than have a beginning came to an end, and Josh moved it to Wikibooks, but the first person writing stuck.  If someone really wants to change it, I will not revert it, but I don't see much point.   (The webpage has since moved to http://jjc.freeshell.org/easytut/ and http://jjc.freeshell.org/easytut3/ )&lt;br /&gt;
; My question is not answered. : Ask on the discussion page or add it to this FAQ, or email one of the [[../Authors|Authors]].  &lt;br /&gt;
&lt;br /&gt;
For other FAQs, you may want to see the Python 2.6 version of this page [[Non-Programmer's Tutorial for Python 2.6/FAQ]], or the [https://docs.python.org/3.5/faq/ Python FAQ].&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=The End |next=Terminai}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Terminai&amp;diff=3078</id>
		<title>Python Vadovėlis/Terminai</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Terminai&amp;diff=3078"/>
		<updated>2021-09-22T12:42:00Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Computer - Kompiuteris&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=FAQ |next=END}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Terminai&amp;diff=3077</id>
		<title>Python Vadovėlis/Terminai</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Terminai&amp;diff=3077"/>
		<updated>2021-09-22T12:39:46Z</updated>

		<summary type="html">&lt;p&gt;Mantas: Naujas puslapis: Computer - Kompiuteris&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Computer - Kompiuteris&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis&amp;diff=3076</id>
		<title>Python Vadovėlis</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis&amp;diff=3076"/>
		<updated>2021-09-22T12:39:27Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tai - standartinės Python programavimo kalbos vadovėlis, išverstas iš [https://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3 Non programmer's Tutorial for Python 3].&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis yra atvirojo kodo, [https://www.gnu.org/licenses/gpl-3.0.html GPL v3] licencija.&lt;br /&gt;
&lt;br /&gt;
==Contents==&lt;br /&gt;
{{print version}}&lt;br /&gt;
{{PDF version}}&lt;br /&gt;
;[[Vadovėlis/Authors]] &lt;br /&gt;
: Contributors to this book&lt;br /&gt;
;[[Vadovėlis/Front matter]]&lt;br /&gt;
: Initial remarks&lt;br /&gt;
;[[Vadovėlis/Intro]]&lt;br /&gt;
: Installing and using Python&amp;amp;nbsp;&amp;amp;ndash; where to get help&lt;br /&gt;
;[[Vadovėlis/Hello, World]]&lt;br /&gt;
: The famous first program&amp;amp;nbsp;&amp;amp;ndash; screen output&amp;amp;nbsp;&amp;amp;ndash; variables&amp;amp;nbsp;&amp;amp;ndash; numbers and calculations&lt;br /&gt;
;[[Vadovėlis/Who Goes There?]]&lt;br /&gt;
: Interactive input&amp;amp;nbsp;&amp;amp;ndash; strings&lt;br /&gt;
;[[Vadovėlis/Count to 10]]&lt;br /&gt;
: &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loops&lt;br /&gt;
;[[Vadovėlis/Decisions]]&lt;br /&gt;
: &amp;lt;tt&amp;gt;if&amp;lt;/tt&amp;gt; statements&lt;br /&gt;
;[[Vadovėlis/Debugging]]&lt;br /&gt;
: Finding out what goes wrong&lt;br /&gt;
;[[Vadovėlis/Defining Functions]]&lt;br /&gt;
: Structuring programs with the use of functions&lt;br /&gt;
;[[Vadovėlis/Advanced Functions Example]]&lt;br /&gt;
: (Almost) mind-blowing example of how programmers can think&lt;br /&gt;
;[[Vadovėlis/Lists|Vadovėlis/Lists [Artūras]]]&lt;br /&gt;
: Variables containing more than one value&lt;br /&gt;
;[[Vadovėlis/For Loops|Vadovėlis/For Loops [Artūras]]]&lt;br /&gt;
: A second kind of loop&lt;br /&gt;
;[[Vadovėlis/Boolean Expressions]]&lt;br /&gt;
: Computer logic&amp;amp;nbsp;&amp;amp;ndash; &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;&amp;amp;nbsp;&amp;amp;ndash; &amp;lt;tt&amp;gt;and&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;or&amp;lt;/tt&amp;gt;&amp;amp;nbsp;&amp;amp;ndash; &amp;lt;tt&amp;gt;not&amp;lt;/tt&amp;gt;&lt;br /&gt;
;[[Vadovėlis/Dictionaries]]&lt;br /&gt;
: Variables containing key/value pairs&lt;br /&gt;
;[[Vadovėlis/Using Modules]]&lt;br /&gt;
: Extensions to the standard set of functionality&lt;br /&gt;
;[[Vadovėlis/More on Lists]]&lt;br /&gt;
: Using elements or parts of lists&lt;br /&gt;
;[[Vadovėlis/Revenge of the Strings]]&lt;br /&gt;
: More advanced text manipulations&lt;br /&gt;
;[[Vadovėlis/File IO]]&lt;br /&gt;
: Reading from files and writing to files&lt;br /&gt;
;[[Vadovėlis/Dealing with the imperfect]]&lt;br /&gt;
: How to handle errors&lt;br /&gt;
;[[Vadovėlis/Recursion]]&lt;br /&gt;
: Recursive Functions&lt;br /&gt;
;[[Vadovėlis/Intro to Object Oriented Programming in Python 3]]&lt;br /&gt;
: Basics of OOP (Object Oriented Programming)&lt;br /&gt;
;[[Vadovėlis/Intro to Imported Libraries and other Functions]]&lt;br /&gt;
: Basic functions from various libraries.&lt;br /&gt;
;[[Vadovėlis/The End]]&lt;br /&gt;
: How to go further&lt;br /&gt;
;[[Vadovėlis/FAQ]]&lt;br /&gt;
: Some frequently asked questions&lt;br /&gt;
;[[Vadovėlis/Terminai]]&lt;br /&gt;
: Terminų žodynas&lt;br /&gt;
&lt;br /&gt;
{{Alphabetical|N}}&lt;br /&gt;
{{status|100%}}&lt;br /&gt;
__NOTOC__ __NOEDITSECTION__&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Ciklai_For&amp;diff=3042</id>
		<title>Python Vadovėlis/Ciklai For</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Ciklai_For&amp;diff=3042"/>
		<updated>2021-09-15T13:16:48Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[Artūro dalis]&lt;br /&gt;
&lt;br /&gt;
And here is the new typing exercise for this chapter:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
onetoten = range(1, 11)&lt;br /&gt;
for count in onetoten:&lt;br /&gt;
    print(count)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the ever-present output:&lt;br /&gt;
&lt;br /&gt;
 1&lt;br /&gt;
 2&lt;br /&gt;
 3&lt;br /&gt;
 4&lt;br /&gt;
 5&lt;br /&gt;
 6&lt;br /&gt;
 7&lt;br /&gt;
 8&lt;br /&gt;
 9&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
The output looks awfully familiar but the program code looks different.  The first line uses the &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt; function.  The &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt; function uses two arguments like this &amp;lt;code&amp;gt;range(start, finish)&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt; is the first number that is produced.  &amp;lt;code&amp;gt;finish&amp;lt;/code&amp;gt; is one larger than the last number.  Note that this program could have been done in a shorter way:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
for count in range(1, 11):&lt;br /&gt;
    print(count)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The range function returns an iterable.  This can be converted into a list with the &amp;lt;code&amp;gt;list&amp;lt;/code&amp;gt; function. which will then be the dominant number.  &lt;br /&gt;
Here are some examples to show what happens with the &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; '''range(1, 10)'''&lt;br /&gt;
 range(1, 10)&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; '''list(range(1, 10))'''&lt;br /&gt;
 [1, 2, 3, 4, 5, 6, 7, 8, 9]&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; '''list(range(-32, -20))'''&lt;br /&gt;
 [-32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21]&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; '''list(range(5,21))'''&lt;br /&gt;
 [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; '''list(range(5))'''&lt;br /&gt;
 [0, 1, 2, 3, 4]&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; '''list(range(21, 5))'''&lt;br /&gt;
 []&lt;br /&gt;
&lt;br /&gt;
The next line &amp;lt;code&amp;gt;for count in onetoten:&amp;lt;/code&amp;gt; uses the &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; control structure.  A &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; control structure looks like &amp;lt;code&amp;gt;for variable in list:&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;list&amp;lt;/code&amp;gt; is gone through starting with the first element of the list and going to the last.  As &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; goes through each element in a list it puts each into &amp;lt;code&amp;gt;variable&amp;lt;/code&amp;gt;.  That allows &amp;lt;code&amp;gt;variable&amp;lt;/code&amp;gt; to be used in each successive time the &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loop is run through.  Here is another example (you don't have to type this) to demonstrate:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
demolist = ['life', 42, 'the universe', 6, 'and', 7, 'everything']&lt;br /&gt;
for item in demolist:&lt;br /&gt;
    print(&amp;quot;The current item is:&amp;quot;,item)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 The current item is: life&lt;br /&gt;
 The current item is: 42&lt;br /&gt;
 The current item is: the universe&lt;br /&gt;
 The current item is: 6&lt;br /&gt;
 The current item is: and&lt;br /&gt;
 The current item is: 7&lt;br /&gt;
 The current item is: everything&lt;br /&gt;
&lt;br /&gt;
Notice how the &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loop goes through and sets item to each element in the list. So, what is &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; good for?  The first use is to go through all the elements of a list and do something with each of them.  Here's a quick way to add up all the elements:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
list = [2, 4, 6, 8]&lt;br /&gt;
sum = 0&lt;br /&gt;
for num in list:&lt;br /&gt;
    sum = sum + num&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;The sum is:&amp;quot;, sum)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with the output simply being:&lt;br /&gt;
&lt;br /&gt;
The sum is: 20&lt;br /&gt;
&lt;br /&gt;
Or you could write a program to find out if there are any duplicates in a list like this program does:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
list = [4, 5, 7, 8, 9, 1, 0, 7, 10]&lt;br /&gt;
list.sort()&lt;br /&gt;
prev = None&lt;br /&gt;
for item in list:&lt;br /&gt;
    if prev == item:&lt;br /&gt;
        print(&amp;quot;Duplicate of&amp;quot;, prev, &amp;quot;found&amp;quot;)&lt;br /&gt;
    prev = item&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and for good measure:&lt;br /&gt;
&lt;br /&gt;
 Duplicate of 7 found&lt;br /&gt;
&lt;br /&gt;
Okay, so how does it work?  Here is a special debugging version to help you understand (you don't need to type this in):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
l = [4, 5, 7, 8, 9, 1, 0, 7, 10]&lt;br /&gt;
print(&amp;quot;l = [4, 5, 7, 8, 9, 1, 0, 7, 10]&amp;quot;, &amp;quot;\t\tl:&amp;quot;, l)&lt;br /&gt;
l.sort()&lt;br /&gt;
print(&amp;quot;l.sort()&amp;quot;, &amp;quot;\t\tl:&amp;quot;, l)&lt;br /&gt;
prev = l[0]&lt;br /&gt;
print(&amp;quot;prev = l[0]&amp;quot;, &amp;quot;\t\tprev:&amp;quot;, prev)&lt;br /&gt;
del l[0]&lt;br /&gt;
print(&amp;quot;del l[0]&amp;quot;, &amp;quot;\t\tl:&amp;quot;, l)&lt;br /&gt;
for item in l:&lt;br /&gt;
    if prev == item:&lt;br /&gt;
        print(&amp;quot;Duplicate of&amp;quot;, prev, &amp;quot;found&amp;quot;)&lt;br /&gt;
    print(&amp;quot;if prev == item:&amp;quot;, &amp;quot;\t\tprev:&amp;quot;, prev, &amp;quot;\titem:&amp;quot;, item)&lt;br /&gt;
    prev = item&lt;br /&gt;
    print(&amp;quot;prev = item&amp;quot;, &amp;quot;\t\tprev:&amp;quot;, prev, &amp;quot;\titem:&amp;quot;, item)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with the output being:&lt;br /&gt;
&lt;br /&gt;
 l = [4, 5, 7, 8, 9, 1, 0, 7, 10]        l: [4, 5, 7, 8, 9, 1, 0, 7, 10]&lt;br /&gt;
 l.sort()                l: [0, 1, 4, 5, 7, 7, 8, 9, 10]&lt;br /&gt;
 prev = l[0]             prev: 0&lt;br /&gt;
 del l[0]                l: [1, 4, 5, 7, 7, 8, 9, 10]&lt;br /&gt;
 if prev == item:        prev: 0         item: 1&lt;br /&gt;
 prev = item             prev: 1         item: 1&lt;br /&gt;
 if prev == item:        prev: 1         item: 4&lt;br /&gt;
 prev = item             prev: 4         item: 4&lt;br /&gt;
 if prev == item:        prev: 4         item: 5&lt;br /&gt;
 prev = item             prev: 5         item: 5&lt;br /&gt;
 if prev == item:        prev: 5         item: 7&lt;br /&gt;
 prev = item             prev: 7         item: 7&lt;br /&gt;
 Duplicate of 7 found&lt;br /&gt;
 if prev == item:        prev: 7         item: 7&lt;br /&gt;
 prev = item             prev: 7         item: 7&lt;br /&gt;
 if prev == item:        prev: 7         item: 8&lt;br /&gt;
 prev = item             prev: 8         item: 8&lt;br /&gt;
 if prev == item:        prev: 8         item: 9&lt;br /&gt;
 prev = item             prev: 9         item: 9&lt;br /&gt;
 if prev == item:        prev: 9         item: 10&lt;br /&gt;
 prev = item             prev: 10        item: 10&lt;br /&gt;
&lt;br /&gt;
The reason I put so many &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; statements in the code was so that you can see what is happening in each line.  (By the way, if you can't figure out why a program is not working, try putting in lots of print statements in places where you want to know what is happening.)  First the program starts with a boring old list.  Next the program sorts the list.  This is so that any duplicates get put next to each other.  The program then initializes a &amp;lt;code&amp;gt;prev&amp;lt;/code&amp;gt;(ious) variable.  Next the first element of the list is deleted so that the first item is not incorrectly thought to be a duplicate.  Next a &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loop is gone into.  Each item of the list is checked to see if it is the same as the previous.  If it is a duplicate was found.  The value of &amp;lt;code&amp;gt;prev&amp;lt;/code&amp;gt; is then changed so that the next time the &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loop is run through &amp;lt;code&amp;gt;prev&amp;lt;/code&amp;gt; is the previous item to the current.  Sure enough, the 7 is found to be a duplicate.  (Notice how &amp;lt;code&amp;gt;\t&amp;lt;/code&amp;gt; is used to print a tab.)  &lt;br /&gt;
&lt;br /&gt;
The other way to use &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loops is to do something a certain number of times.  Here is some code to print out the first 9 numbers of the Fibonacci series:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 1&lt;br /&gt;
b = 1&lt;br /&gt;
for c in range(1, 10):&lt;br /&gt;
    print(a, end=&amp;quot; &amp;quot;)&lt;br /&gt;
    n = a + b&lt;br /&gt;
    a = b&lt;br /&gt;
    b = n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with the surprising output:&lt;br /&gt;
&lt;br /&gt;
 1 1 2 3 5 8 13 21 34&lt;br /&gt;
&lt;br /&gt;
Everything that can be done with &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loops can also be done with &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; loops but &amp;lt;code&amp;gt;for&amp;lt;/code&amp;gt; loops give an easy way to go through all the elements in a list or to do something a certain number of times.&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Lists |next=Boolean Expressions}}&lt;br /&gt;
{{BookCat}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/S%C4%85ra%C5%A1ai&amp;diff=3041</id>
		<title>Python Vadovėlis/Sąrašai</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/S%C4%85ra%C5%A1ai&amp;diff=3041"/>
		<updated>2021-09-15T13:16:24Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[Artūro dalis]&lt;br /&gt;
&lt;br /&gt;
=== Variables with more than one value ===&lt;br /&gt;
You have already seen ordinary variables that store a single value.  However other variable types can hold more than one value.  These are called containers because they can contain more than one object.  The simplest type is called a list.  Here is an example of a list being used:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
which_one = int(input(&amp;quot;What month (1-12)? &amp;quot;))&lt;br /&gt;
months = ['January', 'February', 'March', 'April', 'May', 'June', 'July',&lt;br /&gt;
          'August', 'September', 'October', 'November', 'December']&lt;br /&gt;
&lt;br /&gt;
if 1 &amp;lt;= which_one &amp;lt;= 12:&lt;br /&gt;
    print(&amp;quot;The month is&amp;quot;, months[which_one - 1])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and an output example:&lt;br /&gt;
&lt;br /&gt;
 What month (1-12)? '''3'''&lt;br /&gt;
 The month is March&lt;br /&gt;
&lt;br /&gt;
In this example the &amp;lt;code&amp;gt;months&amp;lt;/code&amp;gt; is a list.  &amp;lt;code&amp;gt;months&amp;lt;/code&amp;gt; is defined with the lines &amp;lt;code&amp;gt; months = ['January', 'February', 'March', 'April', 'May', 'June', 'July',&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;'August', 'September', 'October', 'November', 'December']&amp;lt;/code&amp;gt; (note that a &amp;lt;code&amp;gt;\&amp;lt;/code&amp;gt; could also be used to split a long line, but that is not necessary in this case because Python is intelligent enough to recognize that everything within brackets belongs together).  The &amp;lt;code&amp;gt;[&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;]&amp;lt;/code&amp;gt; start and end the list with commas (&amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt;) separating the list items.  The list is used in &amp;lt;code&amp;gt;months[which_one - 1]&amp;lt;/code&amp;gt;.  A list consists of items that are numbered starting at 0.  In other words if you wanted January you would use &amp;lt;code&amp;gt;months[0]&amp;lt;/code&amp;gt;.  Give a list a number and it will return the value that is stored at that location.&lt;br /&gt;
&lt;br /&gt;
The statement &amp;lt;code&amp;gt; if 1 &amp;lt;= which_one &amp;lt;= 12:&amp;lt;/code&amp;gt; will only be true if &amp;lt;code&amp;gt; which_one&amp;lt;/code&amp;gt; is between one and twelve inclusive (in other words it is what you would expect if you have seen that in algebra).&lt;br /&gt;
&lt;br /&gt;
Lists can be thought of as a series of boxes. Each box has a different value. For example, the boxes created by  &amp;lt;code&amp;gt;demolist = ['life', 42, 'the universe', 6, 'and', 9]&amp;lt;/code&amp;gt; would look like this:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!box number &lt;br /&gt;
!0 &lt;br /&gt;
!1  &lt;br /&gt;
!2 &lt;br /&gt;
!3 &lt;br /&gt;
!4 &lt;br /&gt;
!5 &lt;br /&gt;
|-&lt;br /&gt;
|demolist &lt;br /&gt;
|&amp;quot;life&amp;quot; &lt;br /&gt;
|42 &lt;br /&gt;
|&amp;quot;the universe&amp;quot; &lt;br /&gt;
|6 &lt;br /&gt;
|&amp;quot;and&amp;quot;&lt;br /&gt;
|9&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each box is referenced by its number so the statement &amp;lt;code&amp;gt;demolist[0]&amp;lt;/code&amp;gt; would get &amp;lt;code&amp;gt;'life'&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;demolist[1]&amp;lt;/code&amp;gt; would get &amp;lt;code&amp;gt;42&amp;lt;/code&amp;gt; and so on up to &amp;lt;code&amp;gt;demolist[5]&amp;lt;/code&amp;gt; getting &amp;lt;code&amp;gt;9&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== More features of lists ===&lt;br /&gt;
The next example is just to show a lot of other stuff lists can do (for once I don't expect you to type it in, but you should probably play around with lists in interactive mode until you are comfortable with them.).  Here goes:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
demolist = [&amp;quot;life&amp;quot;, 42, &amp;quot;the universe&amp;quot;, 6, &amp;quot;and&amp;quot;, 9]&lt;br /&gt;
print(&amp;quot;demolist = &amp;quot;,demolist)&lt;br /&gt;
demolist.append(&amp;quot;everything&amp;quot;)&lt;br /&gt;
print(&amp;quot;after 'everything' was appended demolist is now:&amp;quot;)&lt;br /&gt;
print(demolist)&lt;br /&gt;
print(&amp;quot;len(demolist) =&amp;quot;, len(demolist))&lt;br /&gt;
print(&amp;quot;demolist.index(42) =&amp;quot;, demolist.index(42))&lt;br /&gt;
print(&amp;quot;demolist[1] =&amp;quot;, demolist[1])&lt;br /&gt;
&lt;br /&gt;
# Next we will loop through the list&lt;br /&gt;
for c in range(len(demolist)):&lt;br /&gt;
    print(&amp;quot;demolist[&amp;quot;, c, &amp;quot;] =&amp;quot;, demolist[c])&lt;br /&gt;
&lt;br /&gt;
del demolist[2]&lt;br /&gt;
print(&amp;quot;After 'the universe' was removed demolist is now:&amp;quot;)&lt;br /&gt;
print(demolist)&lt;br /&gt;
if &amp;quot;life&amp;quot; in demolist:&lt;br /&gt;
    print(&amp;quot;'life' was found in demolist&amp;quot;)&lt;br /&gt;
else:&lt;br /&gt;
    print(&amp;quot;'life' was not found in demolist&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;amoeba&amp;quot; in demolist:&lt;br /&gt;
    print(&amp;quot;'amoeba' was found in demolist&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
if &amp;quot;amoeba&amp;quot; not in demolist:&lt;br /&gt;
    print(&amp;quot;'amoeba' was not found in demolist&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
another_list = [42,7,0,123]&lt;br /&gt;
another_list.sort()&lt;br /&gt;
print(&amp;quot;The sorted another_list is&amp;quot;, another_list)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output is:&lt;br /&gt;
&lt;br /&gt;
 demolist =  ['life', 42, 'the universe', 6, 'and', 9]&lt;br /&gt;
 after 'everything' was appended demolist is now:&lt;br /&gt;
 ['life', 42, 'the universe', 6, 'and', 9, 'everything']&lt;br /&gt;
 len(demolist) = 7&lt;br /&gt;
 demolist.index(42) = 1&lt;br /&gt;
 demolist[1] = 42&lt;br /&gt;
 demolist[ 0 ] = life&lt;br /&gt;
 demolist[ 1 ] = 42&lt;br /&gt;
 demolist[ 2 ] = the universe&lt;br /&gt;
 demolist[ 3 ] = 6&lt;br /&gt;
 demolist[ 4 ] = and&lt;br /&gt;
 demolist[ 5 ] = 9&lt;br /&gt;
 demolist[ 6 ] = everything&lt;br /&gt;
 After 'the universe' was removed demolist is now:&lt;br /&gt;
 ['life', 42, 6, 'and', 9, 'everything']&lt;br /&gt;
 'life' was found in demolist&lt;br /&gt;
 'amoeba' was not found in demolist&lt;br /&gt;
 The sorted another_list is [0, 7, 42, 123]&lt;br /&gt;
&lt;br /&gt;
This example uses a whole bunch of new functions.  Notice that you can&lt;br /&gt;
just &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; a whole list.  Next the &amp;lt;code&amp;gt;append&amp;lt;/code&amp;gt; function is used&lt;br /&gt;
to add a new item to the end of the list.  &amp;lt;code&amp;gt;len&amp;lt;/code&amp;gt; returns how many&lt;br /&gt;
items are in a list.  The valid indexes (as in numbers that can be&lt;br /&gt;
used inside of the &amp;lt;code&amp;gt;[]&amp;lt;/code&amp;gt;) of a list range from 0 to &amp;lt;code&amp;gt;len - 1&amp;lt;/code&amp;gt;. The&lt;br /&gt;
&amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt; function tells where the first location of an item is&lt;br /&gt;
located in a list.  Notice how &amp;lt;code&amp;gt;demolist.index(42)&amp;lt;/code&amp;gt; returns 1, and&lt;br /&gt;
when &amp;lt;code&amp;gt;demolist[1]&amp;lt;/code&amp;gt; is run it returns 42.  To get help on all the functions a list provides for you, type &amp;lt;code&amp;gt;help(list)&amp;lt;/code&amp;gt; in the interactive Python interpreter.&lt;br /&gt;
&lt;br /&gt;
The line &amp;lt;code&amp;gt;# Next we will loop through the list&amp;lt;/code&amp;gt; is a just a reminder to the programmer (also called a ''comment'').  Python ignores everything that is written after a &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; on the current line.  Next the lines:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
for c in range(len(demolist)):&lt;br /&gt;
    print('demolist[', c, '] =', demolist[c])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
create a variable &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt;, which starts at 0 and is incremented until it reaches the last index of the list.  Meanwhile the &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; statement prints out each element of the list.&lt;br /&gt;
&lt;br /&gt;
A much better way to do the above is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
for c, x in enumerate(demolist):&lt;br /&gt;
    print(&amp;quot;demolist[&amp;quot;, c, &amp;quot;] =&amp;quot;, x)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;del&amp;lt;/code&amp;gt; command can be used to remove a given element in a list.  The next few lines use the &amp;lt;code&amp;gt;in&amp;lt;/code&amp;gt; operator to test if an element is in or is not in a list. The &amp;lt;code&amp;gt;sort&amp;lt;/code&amp;gt; function sorts the list. This is useful if you need a&lt;br /&gt;
list in order from smallest number to largest or alphabetical.  Note&lt;br /&gt;
that this rearranges the list. In summary, for a list, the following operations occur:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!example &lt;br /&gt;
!explanation&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;demolist[2]&amp;lt;/code&amp;gt; &lt;br /&gt;
|accesses the element at index 2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;demolist[2] = 3&amp;lt;/code&amp;gt; &lt;br /&gt;
|sets the element at index 2 to be 3&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;del demolist[2]&amp;lt;/code&amp;gt; &lt;br /&gt;
|removes the element at index 2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;len(demolist)&amp;lt;/code&amp;gt; &lt;br /&gt;
|returns the length of &amp;lt;code&amp;gt;demolist&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;value&amp;quot; in demolist&amp;lt;/code&amp;gt; &lt;br /&gt;
|is ''True'' if &amp;lt;tt&amp;gt;&amp;quot;value&amp;quot;&amp;lt;/tt&amp;gt; is an element in &amp;lt;code&amp;gt;demolist&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;value&amp;quot; not in demolist&amp;lt;/code&amp;gt; &lt;br /&gt;
|is ''True'' if &amp;lt;code&amp;gt;&amp;quot;value&amp;quot;&amp;lt;/code&amp;gt; is not an element in &amp;lt;code&amp;gt;demolist&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;another_list.sort()&amp;lt;/code&amp;gt; &lt;br /&gt;
|sorts &amp;lt;code&amp;gt;another_list&amp;lt;/code&amp;gt;.  Note that the list must be all numbers or all strings to be sorted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;demolist.index(&amp;quot;value&amp;quot;)&amp;lt;/code&amp;gt; &lt;br /&gt;
|returns the index of the first place that &amp;lt;code&amp;gt;&amp;quot;value&amp;quot;&amp;lt;/code&amp;gt; occurs&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;demolist.append(&amp;quot;value&amp;quot;)&amp;lt;/code&amp;gt; &lt;br /&gt;
|adds an element &amp;lt;code&amp;gt;&amp;quot;value&amp;quot;&amp;lt;/code&amp;gt; at the end of the list&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;demolist.remove(&amp;quot;value&amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
|removes the first occurrence of value from &amp;lt;code&amp;gt;demolist&amp;lt;/code&amp;gt; (same as &amp;lt;code&amp;gt;del demolist[demolist.index(&amp;quot;value&amp;quot;)]&amp;lt;/code&amp;gt;)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This next example uses these features in a more useful way:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
menu_item = 0&lt;br /&gt;
namelist = []&lt;br /&gt;
while menu_item != 9:&lt;br /&gt;
    print(&amp;quot;--------------------&amp;quot;)&lt;br /&gt;
    print(&amp;quot;1. Print the list&amp;quot;)&lt;br /&gt;
    print(&amp;quot;2. Add a name to the list&amp;quot;)&lt;br /&gt;
    print(&amp;quot;3. Remove a name from the list&amp;quot;)&lt;br /&gt;
    print(&amp;quot;4. Change an item in the list&amp;quot;)&lt;br /&gt;
    print(&amp;quot;9. Quit&amp;quot;)&lt;br /&gt;
    menu_item = int(input(&amp;quot;Pick an item from the menu: &amp;quot;))&lt;br /&gt;
    if menu_item == 1:&lt;br /&gt;
        current = 0&lt;br /&gt;
        if len(namelist) &amp;gt; 0:&lt;br /&gt;
            while current &amp;lt; len(namelist):&lt;br /&gt;
                print(current, &amp;quot;.&amp;quot;, namelist[current])&lt;br /&gt;
                current = current + 1&lt;br /&gt;
        else:&lt;br /&gt;
            print(&amp;quot;List is empty&amp;quot;)&lt;br /&gt;
    elif menu_item == 2:&lt;br /&gt;
        name = input(&amp;quot;Type in a name to add: &amp;quot;)&lt;br /&gt;
        namelist.append(name)&lt;br /&gt;
    elif menu_item == 3:&lt;br /&gt;
        del_name = input(&amp;quot;What name would you like to remove: &amp;quot;)&lt;br /&gt;
        if del_name in namelist:&lt;br /&gt;
            # namelist.remove(del_name) would work just as fine&lt;br /&gt;
            item_number = namelist.index(del_name)&lt;br /&gt;
            del namelist[item_number]&lt;br /&gt;
            # The code above only removes the first occurrence of&lt;br /&gt;
            # the name.  The code below from Gerald removes all.&lt;br /&gt;
            # while del_name in namelist:&lt;br /&gt;
            #       item_number = namelist.index(del_name)&lt;br /&gt;
            #       del namelist[item_number]&lt;br /&gt;
        else:&lt;br /&gt;
            print(del_name, &amp;quot;was not found&amp;quot;)&lt;br /&gt;
    elif menu_item == 4:&lt;br /&gt;
        old_name = input(&amp;quot;What name would you like to change: &amp;quot;)&lt;br /&gt;
        if old_name in namelist:&lt;br /&gt;
            item_number = namelist.index(old_name)&lt;br /&gt;
            new_name = input(&amp;quot;What is the new name: &amp;quot;)&lt;br /&gt;
            namelist[item_number] = new_name&lt;br /&gt;
        else:&lt;br /&gt;
            print(old_name, &amp;quot;was not found&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;Goodbye&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And here is part of the output:&lt;br /&gt;
&lt;br /&gt;
 --------------------&lt;br /&gt;
 1. Print the list&lt;br /&gt;
 2. Add a name to the list&lt;br /&gt;
 3. Remove a name from the list&lt;br /&gt;
 4. Change an item in the list&lt;br /&gt;
 9. Quit&lt;br /&gt;
 &lt;br /&gt;
 Pick an item from the menu: '''2'''&lt;br /&gt;
 Type in a name to add: '''Jack'''&lt;br /&gt;
 &lt;br /&gt;
 Pick an item from the menu: '''2'''&lt;br /&gt;
 Type in a name to add: '''Jill'''&lt;br /&gt;
 &lt;br /&gt;
 Pick an item from the menu: '''1'''&lt;br /&gt;
 0 . Jack&lt;br /&gt;
 1 . Jill&lt;br /&gt;
 &lt;br /&gt;
 Pick an item from the menu: '''3'''&lt;br /&gt;
 What name would you like to remove: '''Jack'''&lt;br /&gt;
 &lt;br /&gt;
 Pick an item from the menu: '''4'''&lt;br /&gt;
 What name would you like to change: '''Jill'''&lt;br /&gt;
 What is the new name: '''Jill Peters'''&lt;br /&gt;
 &lt;br /&gt;
 Pick an item from the menu: '''1'''&lt;br /&gt;
 0 . Jill Peters&lt;br /&gt;
 &lt;br /&gt;
 Pick an item from the menu: '''9'''&lt;br /&gt;
 Goodbye&lt;br /&gt;
&lt;br /&gt;
That was a long program.  Let's take a look at the source code. The line &amp;lt;code&amp;gt;namelist = []&amp;lt;/code&amp;gt; makes the variable &amp;lt;code&amp;gt;namelist&amp;lt;/code&amp;gt; a list with no items (or elements).  The next important line is &amp;lt;code&amp;gt;while menu_item != 9:&amp;lt;/code&amp;gt;.  This line starts a loop that allows the menu system for this program.  The next few lines display a menu and decide which part of the program to run.&lt;br /&gt;
&lt;br /&gt;
The section&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
current = 0&lt;br /&gt;
if len(namelist) &amp;gt; 0:&lt;br /&gt;
    while current &amp;lt; len(namelist):&lt;br /&gt;
        print(current, &amp;quot;.&amp;quot;, namelist[current])&lt;br /&gt;
        current = current + 1&lt;br /&gt;
else:&lt;br /&gt;
    print(&amp;quot;List is empty&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
goes through the list and prints each name.  &amp;lt;code&amp;gt;len(namelist)&amp;lt;/code&amp;gt; tells how many items are in the list.  If &amp;lt;code&amp;gt;len&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;, then the list is empty.&lt;br /&gt;
&lt;br /&gt;
Then, a few lines later, the statement &amp;lt;code&amp;gt;namelist.append(name)&amp;lt;/code&amp;gt; appears.  It uses the &amp;lt;code&amp;gt;append&amp;lt;/code&amp;gt; function to add an item to the end of the list.  Jump down another two lines, and notice this section of code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
item_number = namelist.index(del_name)&lt;br /&gt;
del namelist[item_number]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Here the &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt; function is used to find the index value that will be used later to remove the item.  &amp;lt;code&amp;gt;del namelist[item_number]&amp;lt;/code&amp;gt; is used to remove an element of the list.   &lt;br /&gt;
&lt;br /&gt;
The next section&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
old_name = input(&amp;quot;What name would you like to change: &amp;quot;)&lt;br /&gt;
if old_name in namelist:&lt;br /&gt;
    item_number = namelist.index(old_name)&lt;br /&gt;
    new_name = input(&amp;quot;What is the new name: &amp;quot;)&lt;br /&gt;
    namelist[item_number] = new_name&lt;br /&gt;
else:&lt;br /&gt;
   print(old_name, &amp;quot;was not found&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
uses &amp;lt;code&amp;gt;index&amp;lt;/code&amp;gt; to find the &amp;lt;code&amp;gt;item_number&amp;lt;/code&amp;gt; and then puts &amp;lt;code&amp;gt;new_name&amp;lt;/code&amp;gt; where the &amp;lt;code&amp;gt;old_name&amp;lt;/code&amp;gt; was.&lt;br /&gt;
&lt;br /&gt;
Congratulations, with lists under your belt, you now know enough of the language&lt;br /&gt;
that you could do any computations that a computer can do (this is technically known as [[Wikipedia:Turing_completeness|Turing-Completeness]]).  Of course, there are still many features that&lt;br /&gt;
are used to make your life easier.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
'''test.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
## This program runs a test of knowledge&lt;br /&gt;
&lt;br /&gt;
# First get the test questions&lt;br /&gt;
# Later this will be modified to use file io.&lt;br /&gt;
def get_questions():&lt;br /&gt;
    # notice how the data is stored as a list of lists&lt;br /&gt;
    return [[&amp;quot;What color is the daytime sky on a clear day? &amp;quot;, &amp;quot;blue&amp;quot;],&lt;br /&gt;
            [&amp;quot;What is the answer to life, the universe and everything? &amp;quot;, &amp;quot;42&amp;quot;],&lt;br /&gt;
            [&amp;quot;What is a three letter word for mouse trap? &amp;quot;, &amp;quot;cat&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
# This will test a single question&lt;br /&gt;
# it takes a single question in&lt;br /&gt;
# it returns True if the user typed the correct answer, otherwise False&lt;br /&gt;
&lt;br /&gt;
def check_question(question_and_answer):&lt;br /&gt;
    # extract the question and the answer from the list&lt;br /&gt;
    # This function takes a list with two elements, a question and an answer.  &lt;br /&gt;
    question = question_and_answer[0]   &lt;br /&gt;
    answer = question_and_answer[1]&lt;br /&gt;
    # give the question to the user&lt;br /&gt;
    given_answer = input(question)&lt;br /&gt;
    # compare the user's answer to the tester's answer&lt;br /&gt;
    if answer == given_answer:&lt;br /&gt;
        print(&amp;quot;Correct&amp;quot;)&lt;br /&gt;
        return True&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Incorrect, correct was:&amp;quot;, answer)&lt;br /&gt;
        return False&lt;br /&gt;
&lt;br /&gt;
# This will run through all the questions&lt;br /&gt;
def run_test(questions):&lt;br /&gt;
    if len(questions) == 0:&lt;br /&gt;
        print(&amp;quot;No questions were given.&amp;quot;)&lt;br /&gt;
        # the return exits the function&lt;br /&gt;
        return&lt;br /&gt;
    index = 0&lt;br /&gt;
    right = 0&lt;br /&gt;
    while index &amp;lt; len(questions):&lt;br /&gt;
        # Check the question&lt;br /&gt;
        #Note that this is extracting a question and answer list from the list of lists.&lt;br /&gt;
        if check_question(questions[index]): &lt;br /&gt;
            right = right + 1&lt;br /&gt;
        # go to the next question&lt;br /&gt;
        index = index + 1&lt;br /&gt;
    # notice the order of the computation, first multiply, then divide&lt;br /&gt;
    print(&amp;quot;You got&amp;quot;, right * 100 / len(questions),\&lt;br /&gt;
           &amp;quot;% right out of&amp;quot;, len(questions))&lt;br /&gt;
&lt;br /&gt;
# now let's get the questions from the get_questions function, and&lt;br /&gt;
# send the returned list of lists as an argument to the run_test function.&lt;br /&gt;
&lt;br /&gt;
run_test(get_questions())&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The values &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; point to 1 and 0, respectively. They are often used in sanity checks, loop conditions etc. You will learn more about this a little bit later (chapter [[../Boolean Expressions|Boolean Expressions]]).&lt;br /&gt;
Please note that get_questions() is essentially a list because even though it's technically a function, returning a list of lists is the only thing it does. &lt;br /&gt;
&lt;br /&gt;
Sample Output:&lt;br /&gt;
&lt;br /&gt;
 What color is the daytime sky on a clear day? '''green'''&lt;br /&gt;
 Incorrect, correct was: blue&lt;br /&gt;
 What is the answer to life, the universe and everything? '''42'''&lt;br /&gt;
 Correct&lt;br /&gt;
 What is a three letter word for mouse trap? '''cat'''&lt;br /&gt;
 Correct&lt;br /&gt;
 You got 66 % right out of 3&lt;br /&gt;
&lt;br /&gt;
=== Exercises ===&lt;br /&gt;
Expand the test.py program so it has a menu giving the option of taking&lt;br /&gt;
the test, viewing the list of questions and answers, and an option to&lt;br /&gt;
quit.  Also, add a new question to ask, &amp;quot;What noise does a truly&lt;br /&gt;
advanced machine make?&amp;quot; with the answer of &amp;quot;ping&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
&lt;br /&gt;
Expand the test.py program so it has menu giving the option of taking&lt;br /&gt;
the test, viewing the list of questions and answers, and an option to&lt;br /&gt;
quit.  Also, add a new question to ask, &amp;quot;What noise does a truly&lt;br /&gt;
advanced machine make?&amp;quot; with the answer of &amp;quot;ping&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
## This program runs a test of knowledge&lt;br /&gt;
&lt;br /&gt;
questions = [[&amp;quot;What color is the daytime sky on a clear day? &amp;quot;, &amp;quot;blue&amp;quot;],&lt;br /&gt;
             [&amp;quot;What is the answer to life, the universe and everything? &amp;quot;, &amp;quot;42&amp;quot;],&lt;br /&gt;
             [&amp;quot;What is a three letter word for mouse trap? &amp;quot;, &amp;quot;cat&amp;quot;],&lt;br /&gt;
             [&amp;quot;What noise does a truly advanced machine make?&amp;quot;, &amp;quot;ping&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
# This will test a single question&lt;br /&gt;
# it takes a single question in&lt;br /&gt;
# it returns True if the user typed the correct answer, otherwise False&lt;br /&gt;
&lt;br /&gt;
def check_question(question_and_answer):&lt;br /&gt;
    # extract the question and the answer from the list&lt;br /&gt;
    question = question_and_answer[0]&lt;br /&gt;
    answer = question_and_answer[1]&lt;br /&gt;
    # give the question to the user&lt;br /&gt;
    given_answer = input(question)&lt;br /&gt;
    # compare the user's answer to the testers answer&lt;br /&gt;
    if answer == given_answer:&lt;br /&gt;
        print(&amp;quot;Correct&amp;quot;)&lt;br /&gt;
        return True&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Incorrect, correct was:&amp;quot;, answer)&lt;br /&gt;
        return False&lt;br /&gt;
&lt;br /&gt;
# This will run through all the questions&lt;br /&gt;
&lt;br /&gt;
def run_test(questions):&lt;br /&gt;
&lt;br /&gt;
    if len(questions) == 0:&lt;br /&gt;
        print(&amp;quot;No questions were given.&amp;quot;)&lt;br /&gt;
        # the return exits the function&lt;br /&gt;
        return&lt;br /&gt;
    index = 0&lt;br /&gt;
    right = 0&lt;br /&gt;
    while index &amp;lt; len(questions):&lt;br /&gt;
        # Check the question&lt;br /&gt;
        if check_question(questions[index]):&lt;br /&gt;
            right = right + 1&lt;br /&gt;
        # go to the next question&lt;br /&gt;
        index = index + 1&lt;br /&gt;
    # notice the order of the computation, first multiply, then divide&lt;br /&gt;
    print(&amp;quot;You got&amp;quot;, right * 100 / len(questions),&lt;br /&gt;
           &amp;quot;% right out of&amp;quot;, len(questions))&lt;br /&gt;
&lt;br /&gt;
#showing a list of questions and answers&lt;br /&gt;
def showquestions():&lt;br /&gt;
    q = 0&lt;br /&gt;
    while q &amp;lt; len(questions):&lt;br /&gt;
        a = 0&lt;br /&gt;
        print(&amp;quot;Q:&amp;quot; , questions[q][a])&lt;br /&gt;
        a = 1&lt;br /&gt;
        print(&amp;quot;A:&amp;quot; , questions[q][a])&lt;br /&gt;
        q = q + 1&lt;br /&gt;
&lt;br /&gt;
# now let's define the menu function&lt;br /&gt;
def menu():&lt;br /&gt;
    print(&amp;quot;-----------------&amp;quot;)&lt;br /&gt;
    print(&amp;quot;Menu:&amp;quot;)&lt;br /&gt;
    print(&amp;quot;1 - Take the test&amp;quot;)&lt;br /&gt;
    print(&amp;quot;2 - View a list of questions and answers&amp;quot;)&lt;br /&gt;
    print(&amp;quot;3 - View the menu&amp;quot;)&lt;br /&gt;
    print(&amp;quot;5 - Quit&amp;quot;)&lt;br /&gt;
    print(&amp;quot;-----------------&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
choice = &amp;quot;3&amp;quot;&lt;br /&gt;
while choice != &amp;quot;5&amp;quot;:&lt;br /&gt;
    if choice == &amp;quot;1&amp;quot;:&lt;br /&gt;
        run_test(questions)&lt;br /&gt;
    elif choice == &amp;quot;2&amp;quot;:&lt;br /&gt;
        showquestions()&lt;br /&gt;
    elif choice == &amp;quot;3&amp;quot;:&lt;br /&gt;
        menu()&lt;br /&gt;
    print()&lt;br /&gt;
    choice = input(&amp;quot;Choose your option from the menu above: &amp;quot;) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Advanced Functions Example |next=For Loops}}&lt;br /&gt;
{{BookCat}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Rekursin%C4%97s_funkcijos&amp;diff=3026</id>
		<title>Python Vadovėlis/Rekursinės funkcijos</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Rekursin%C4%97s_funkcijos&amp;diff=3026"/>
		<updated>2021-09-13T10:31:30Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some people find this section useful, and some find it confusing.  If you find it confusing you can skip it.  Now we will do a walk through for the following program:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def mult(a, b):&lt;br /&gt;
    if b == 0:&lt;br /&gt;
        return 0&lt;br /&gt;
    rest = mult(a, b - 1)&lt;br /&gt;
    value = a + rest&lt;br /&gt;
    return value&lt;br /&gt;
result = mult(3, 2)&lt;br /&gt;
print(&amp;quot;3 * 2 = &amp;quot;, result)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Basically this program creates a positive integer multiplication function&lt;br /&gt;
(that is far slower than the built in multiplication function) and then&lt;br /&gt;
demonstrates this function with a use of the function. This program demonstrates the use of recursion, that is a form of iteration (repetition) in which there is a function that repeatedly calls itself until an exit condition is satisfied. It uses repeated additions to give the same result as mutiplication: e.g. 3&amp;amp;nbsp;+&amp;amp;nbsp;3 (addition) gives the same result as 3&amp;amp;nbsp;*&amp;amp;nbsp;2 (multiplication).&lt;br /&gt;
&lt;br /&gt;
; ''Question:'' What is the first thing the program does?&lt;br /&gt;
: ''Answer:'' The first thing done is the function mult is defined with the lines:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def mult(a, b):&lt;br /&gt;
    if b == 0:&lt;br /&gt;
        return 0&lt;br /&gt;
    rest = mult(a, b - 1)&lt;br /&gt;
    value = a + rest&lt;br /&gt;
    return value&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
: This creates a function that takes two parameters and returns a value when it is done.  Later this function can be run.&lt;br /&gt;
; What happens next?  &lt;br /&gt;
: The next line after the function, &amp;lt;code&amp;gt;result = mult(3, 2)&amp;lt;/code&amp;gt; is run.&lt;br /&gt;
; What does this line do?&lt;br /&gt;
: This line will assign the return value of &amp;lt;code&amp;gt;mult(3, 2)&amp;lt;/code&amp;gt; to the variable &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;.&lt;br /&gt;
; And what does &amp;lt;code&amp;gt;mult(3, 2)&amp;lt;/code&amp;gt; return?&lt;br /&gt;
: We need to do a walkthrough of the &amp;lt;code&amp;gt;mult&amp;lt;/code&amp;gt; function to find out.&lt;br /&gt;
; What happens next?&lt;br /&gt;
: The variable &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; gets the value 3 assigned to it and the variable &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; gets the value 2 assigned to it.&lt;br /&gt;
; And then?&lt;br /&gt;
: The line &amp;lt;code&amp;gt;if b == 0:&amp;lt;/code&amp;gt; is run.  Since &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; has the value 2 this is false so the line &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt; is skipped.&lt;br /&gt;
; And what then?&lt;br /&gt;
: The line &amp;lt;code&amp;gt;rest = mult(a, b - 1)&amp;lt;/code&amp;gt; is run.  This line sets the local variable &amp;lt;code&amp;gt;rest&amp;lt;/code&amp;gt; to the value of &amp;lt;code&amp;gt;mult(a, b - 1)&amp;lt;/code&amp;gt;.  The value of &amp;lt;code&amp;gt; a&amp;lt;/code&amp;gt; is 3 and the value of &amp;lt;code&amp;gt; b&amp;lt;/code&amp;gt; is 2 so the function call is &amp;lt;code&amp;gt;mult(3,1)&amp;lt;/code&amp;gt;&lt;br /&gt;
; So what is the value of &amp;lt;code&amp;gt;mult(3, 1)&amp;lt;/code&amp;gt; ?&lt;br /&gt;
: We will need to run the function &amp;lt;code&amp;gt; mult&amp;lt;/code&amp;gt; with the parameters 3 and 1.&lt;br /&gt;
; So what happens next?&lt;br /&gt;
: The local variables in the '' new'' run of the function are set so that &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; has the value 3 and &amp;lt;code&amp;gt; b&amp;lt;/code&amp;gt; has the value 1. Since these are local values these do not affect the previous values of &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt;.&lt;br /&gt;
; And then?&lt;br /&gt;
: Since &amp;lt;code&amp;gt; b&amp;lt;/code&amp;gt; has the value 1 the if statement is false, so the next line becomes &amp;lt;code&amp;gt;rest = mult(a, b - 1)&amp;lt;/code&amp;gt;.&lt;br /&gt;
; What does this line do?&lt;br /&gt;
: This line will assign the value of &amp;lt;code&amp;gt;mult(3, 0)&amp;lt;/code&amp;gt; to rest.&lt;br /&gt;
; So what is that value?&lt;br /&gt;
: We will have to run the function one more time to find that out. This time &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; has the value 3 and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; has the value 0.&lt;br /&gt;
; So what happens next?&lt;br /&gt;
: The first line in the function to run is &amp;lt;code&amp;gt;if b == 0:&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt; b&amp;lt;/code&amp;gt; has the value 0 so the next line to run is &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt; &lt;br /&gt;
; And what does the line &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt; do?&lt;br /&gt;
: This line returns the value 0 out of the function. &lt;br /&gt;
; So?&lt;br /&gt;
: So now we know that &amp;lt;code&amp;gt;mult(3, 0)&amp;lt;/code&amp;gt; has the value 0.  Now we know what the line &amp;lt;code&amp;gt;rest = mult(a, b - 1)&amp;lt;/code&amp;gt; did since we have run the function &amp;lt;code&amp;gt;mult&amp;lt;/code&amp;gt; with the parameters 3 and 0.  We have finished running &amp;lt;code&amp;gt;mult(3, 0)&amp;lt;/code&amp;gt; and are now back to running &amp;lt;code&amp;gt; mult(3, 1)&amp;lt;/code&amp;gt;. The variable &amp;lt;code&amp;gt;rest&amp;lt;/code&amp;gt; gets assigned the value 0.&lt;br /&gt;
; What line is run next?&lt;br /&gt;
: The line &amp;lt;code&amp;gt;value = a + rest&amp;lt;/code&amp;gt; is run next. In this run of the function, &amp;lt;code&amp;gt;a = 3&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rest = 0&amp;lt;/code&amp;gt; so now &amp;lt;code&amp;gt;value = 3&amp;lt;/code&amp;gt;.  &lt;br /&gt;
; What happens next?&lt;br /&gt;
: The line &amp;lt;code&amp;gt;return value&amp;lt;/code&amp;gt; is run.  This returns 3 from the function. This also exits from the run of the function &amp;lt;code&amp;gt; mult(3, 1)&amp;lt;/code&amp;gt;.  After &amp;lt;code&amp;gt;return&amp;lt;/code&amp;gt; is called, we go back to running &amp;lt;code&amp;gt; mult(3, 2)&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Where were we in &amp;lt;code&amp;gt; mult(3, 2)&amp;lt;/code&amp;gt;?&lt;br /&gt;
: We had the variables &amp;lt;code&amp;gt;a = 3&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b = 2&amp;lt;/code&amp;gt; and were examining the line &amp;lt;code&amp;gt;rest = mult(a, b - 1)&amp;lt;/code&amp;gt;.&lt;br /&gt;
; So what happens now?&lt;br /&gt;
: The variable &amp;lt;code&amp;gt;rest&amp;lt;/code&amp;gt; get 3 assigned to it.  The next line &amp;lt;code&amp;gt;value = a + rest&amp;lt;/code&amp;gt; sets &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;3 + 3&amp;lt;/code&amp;gt; or 6.  &lt;br /&gt;
; So now what happens?&lt;br /&gt;
: The next line runs, this returns 6 from the function.  We are now back to running the line &amp;lt;code&amp;gt;result = mult(3, 2)&amp;lt;/code&amp;gt; which can now assign the value 6 to the variable &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt;.&lt;br /&gt;
; What happens next?  &lt;br /&gt;
: The next line after the function, &amp;lt;code&amp;gt;print(&amp;quot;3 * 2 = &amp;quot;, result)&amp;lt;/code&amp;gt; is run.&lt;br /&gt;
; And what does this do?&lt;br /&gt;
: It prints &amp;lt;code&amp;gt;3 * 2 = &amp;lt;/code&amp;gt; and the value of &amp;lt;code&amp;gt;result&amp;lt;/code&amp;gt; which is 6. The complete line printed is &amp;lt;code&amp;gt;3 * 2 = 6&amp;lt;/code&amp;gt;.&lt;br /&gt;
; What is happening overall?  &lt;br /&gt;
: Basically we used two facts to calculate the multiple of the two numbers.  The first is that any number times 0 is 0 (&amp;lt;code&amp;gt;x * 0 = 0&amp;lt;/code&amp;gt;).  The second is that a number times another number is equal to the first number plus the first number times one less than the second number (&amp;lt;code&amp;gt;x * y = x + x * (y - 1)&amp;lt;/code&amp;gt;).  So what happens is &amp;lt;code&amp;gt;3 * 2&amp;lt;/code&amp;gt; is first converted into &amp;lt;code&amp;gt; 3 + 3 * 1&amp;lt;/code&amp;gt;.  Then &amp;lt;code&amp;gt;3 * 1&amp;lt;/code&amp;gt; is converted into &amp;lt;code&amp;gt;3 + 3 * 0&amp;lt;/code&amp;gt;.  Then we know that any number times 0 is 0 so &amp;lt;code&amp;gt;3 * 0&amp;lt;/code&amp;gt; is 0.  Then we can calculate that &amp;lt;code&amp;gt;3 + 3 * 0&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;3 + 0&amp;lt;/code&amp;gt; which is &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;.  Now we know what &amp;lt;code&amp;gt;3 * 1&amp;lt;/code&amp;gt; is so we can calculate that &amp;lt;code&amp;gt;3 + 3 * 1&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;3 + 3&amp;lt;/code&amp;gt; which is &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is how the whole thing works:&lt;br /&gt;
&lt;br /&gt;
 mult(3, 2)&lt;br /&gt;
 3 + mult(3, 1)&lt;br /&gt;
 3 + 3 + mult(3, 0)&lt;br /&gt;
 3 + 3 + 0&lt;br /&gt;
 3 + 3&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
==== Recursion ====&lt;br /&gt;
Programming constructs solving a problem by solving a smaller version of the same problem are called ''recursive''. In the examples in this chapter, recursion is realized by defining a function calling itself. This facilitates implementing solutions to programming tasks as it may be sufficient to consider the next step of a problem instead of the whole problem at once. It is also useful as it allows to express some mathematical concepts with straightforward, easy to read code.&lt;br /&gt;
&lt;br /&gt;
Any problem that can be solved with recursion could be re-implemented with loops. Using the latter usually results in better performance. However equivalent implementations using loops are usually harder to get done correctly.&lt;br /&gt;
&lt;br /&gt;
Probably the most intuitive definition of ''recursion'' is:&lt;br /&gt;
; Recursion&lt;br /&gt;
: If you still don't get it, see ''recursion''.&lt;br /&gt;
&lt;br /&gt;
Try walking through the factorial example if the multiplication example did not make sense.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
'''factorial.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#defines a function that calculates the factorial&lt;br /&gt;
&lt;br /&gt;
def factorial(n):&lt;br /&gt;
    if n == 0:&lt;br /&gt;
        return 1&lt;br /&gt;
    if n&amp;lt;0:&lt;br /&gt;
        return &amp;quot;Error, negative numbers do not have factorial values!!&amp;quot;&lt;br /&gt;
    return n * factorial(n - 1)&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;2! =&amp;quot;, factorial(2))&lt;br /&gt;
print(&amp;quot;3! =&amp;quot;, factorial(3))&lt;br /&gt;
print(&amp;quot;4! =&amp;quot;, factorial(4))&lt;br /&gt;
print(&amp;quot;5! =&amp;quot;, factorial(5))&lt;br /&gt;
print(&amp;quot;-3! =&amp;quot;, factorial(-3))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 &lt;br /&gt;
 2! = 2&lt;br /&gt;
 3! = 6&lt;br /&gt;
 4! = 24&lt;br /&gt;
 5! = 120&lt;br /&gt;
 -3! = Error, negative values do not have factorial values!!&lt;br /&gt;
&lt;br /&gt;
'''countdown.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def count_down(n):&lt;br /&gt;
    print(n)&lt;br /&gt;
    if n &amp;gt; 0:&lt;br /&gt;
        return count_down(n-1)&lt;br /&gt;
&lt;br /&gt;
count_down(5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 5&lt;br /&gt;
 4&lt;br /&gt;
 3&lt;br /&gt;
 2&lt;br /&gt;
 1&lt;br /&gt;
 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--Now try replacing the &amp;quot;if&amp;quot; with &amp;quot;while&amp;quot; (you are still typing these out, right?).  Now you've managed to turn your computer into a calculator which can't correctly count down from four.  In essence, &amp;quot;while&amp;quot; acts as combined &amp;quot;if&amp;quot; and &amp;quot;repeat.&amp;quot;  Throwing in two recursions makes for some interesting counting.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Defining Functions |next=Lists}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Funkcij%C5%B3_apibr%C4%97%C5%BEimas&amp;diff=3025</id>
		<title>Python Vadovėlis/Funkcijų apibrėžimas</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Funkcij%C5%B3_apibr%C4%97%C5%BEimas&amp;diff=3025"/>
		<updated>2021-09-13T10:31:19Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Creating Functions ===&lt;br /&gt;
To start off this chapter I am going to give you an example of what you could do but shouldn't (so don't type it in):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
a = 23&lt;br /&gt;
b = -23&lt;br /&gt;
&lt;br /&gt;
if a &amp;lt; 0:&lt;br /&gt;
    a = -a&lt;br /&gt;
if b &amp;lt; 0:&lt;br /&gt;
    b = -b&lt;br /&gt;
if a == b:&lt;br /&gt;
    print(&amp;quot;The absolute values of&amp;quot;, a, &amp;quot;and&amp;quot;, b, &amp;quot;are equal.&amp;quot;)&lt;br /&gt;
else:&lt;br /&gt;
    print(&amp;quot;The absolute values of&amp;quot;, a, &amp;quot;and&amp;quot;, b, &amp;quot;are different.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with the output being:&lt;br /&gt;
&lt;br /&gt;
 The absolute values of 23 and 23 are equal.&lt;br /&gt;
&lt;br /&gt;
The program seems a little repetitive. Programmers hate to repeat things -- that's what computers are for, after all! (Note also that finding the absolute value changed the value of the variable, which is why it is printing out 23, and not -23 in the output.) Fortunately Python allows you to create functions to remove duplication.  Here is the rewritten example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
a = 23&lt;br /&gt;
b = -23&lt;br /&gt;
&lt;br /&gt;
def absolute_value(n):&lt;br /&gt;
    if n &amp;lt; 0:&lt;br /&gt;
        n = -n&lt;br /&gt;
    return n&lt;br /&gt;
&lt;br /&gt;
if absolute_value(a) == absolute_value(b):&lt;br /&gt;
    print(&amp;quot;The absolute values of&amp;quot;, a, &amp;quot;and&amp;quot;, b, &amp;quot;are equal.&amp;quot;)&lt;br /&gt;
else:&lt;br /&gt;
    print(&amp;quot;The absolute values of&amp;quot;, a, &amp;quot;and&amp;quot;, b, &amp;quot;are different.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with the output being:&lt;br /&gt;
&lt;br /&gt;
 The absolute values of 23 and -23 are equal.&lt;br /&gt;
&lt;br /&gt;
The key feature of this program is the &amp;lt;code&amp;gt;def&amp;lt;/code&amp;gt; statement.  &amp;lt;code&amp;gt;def&amp;lt;/code&amp;gt;&lt;br /&gt;
(short for define) starts a function definition.  &amp;lt;code&amp;gt;def&amp;lt;/code&amp;gt; is&lt;br /&gt;
followed by the name of the function &amp;lt;code&amp;gt;absolute_value&amp;lt;/code&amp;gt;.  Next comes a '(' followed by the parameter &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; is passed from the program into the function when the function is called).  The statements after the ':' are executed when the function is used.  The statements continue until either the indented statements end or a &amp;lt;code&amp;gt;return&amp;lt;/code&amp;gt; is encountered.  The &amp;lt;code&amp;gt;return&amp;lt;/code&amp;gt; statement returns a value back to the place where the function was called. We already have encountered a function in our very first program, the &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; function.  Now we can make new functions.  &lt;br /&gt;
&lt;br /&gt;
Notice how the values of &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are not changed.&lt;br /&gt;
Functions can be used to repeat tasks that don't return&lt;br /&gt;
values.  Here are some examples:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def hello():&lt;br /&gt;
    print(&amp;quot;Hello&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
def area(width, height):&lt;br /&gt;
    return width * height&lt;br /&gt;
&lt;br /&gt;
def print_welcome(name):&lt;br /&gt;
    print(&amp;quot;Welcome&amp;quot;, name)&lt;br /&gt;
&lt;br /&gt;
hello()&lt;br /&gt;
hello()&lt;br /&gt;
&lt;br /&gt;
print_welcome(&amp;quot;Fred&amp;quot;)&lt;br /&gt;
w = 4&lt;br /&gt;
h = 5&lt;br /&gt;
print(&amp;quot;width =&amp;quot;, w, &amp;quot; height =&amp;quot;, h, &amp;quot; area =&amp;quot;, area(w, h))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with output being:&lt;br /&gt;
&lt;br /&gt;
 Hello&lt;br /&gt;
 Hello&lt;br /&gt;
 Welcome Fred&lt;br /&gt;
 width = 4  height = 5  area = 20&lt;br /&gt;
&lt;br /&gt;
That example shows some more stuff that you can do with&lt;br /&gt;
functions.  Notice that you can use no arguments or two or more.&lt;br /&gt;
Notice also when a function doesn't need to send back a value, a&lt;br /&gt;
return is optional.&lt;br /&gt;
&amp;lt;!-- Functions can be used to eliminate repeat code. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Variables in functions ===&lt;br /&gt;
When eliminating repeated code, you often have variables in the repeated code.  In Python, these are dealt with in a special way.  So far all variables we have seen are global variables.  Functions have a special type of variable called local variables.  These variables only exist while the function is running.  When a local variable has the same name as another variable (such as a global variable), the local variable hides the other.  Sound confusing?  Well, these next examples (which are a bit contrived) should help clear things up.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 4&lt;br /&gt;
 &lt;br /&gt;
def print_func():&lt;br /&gt;
    a = 17&lt;br /&gt;
    print(&amp;quot;in print_func a =&amp;quot;, a)&lt;br /&gt;
&lt;br /&gt;
print_func()&lt;br /&gt;
print(&amp;quot;a = &amp;quot;, a)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When run, we will receive an output of:&lt;br /&gt;
&lt;br /&gt;
 in print_func a = 17&lt;br /&gt;
 a = 4&lt;br /&gt;
&lt;br /&gt;
Variable assignments inside a function do not override global variables, they exist only inside the function.  Even though &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; was assigned a new value inside the function, this newly assigned value was only relevant to &amp;lt;code&amp;gt;print_func&amp;lt;/code&amp;gt;, when &lt;br /&gt;
the function finishes running, and the &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;'s values is printed again, we see the originally assigned values.&lt;br /&gt;
&lt;br /&gt;
Here is another more complex example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a_var = 10&lt;br /&gt;
b_var = 15&lt;br /&gt;
e_var = 25&lt;br /&gt;
&lt;br /&gt;
def a_func(a_var):&lt;br /&gt;
    print(&amp;quot;in a_func a_var =&amp;quot;, a_var)&lt;br /&gt;
    b_var = 100 + a_var&lt;br /&gt;
    d_var = 2 * a_var&lt;br /&gt;
    print(&amp;quot;in a_func b_var =&amp;quot;, b_var)&lt;br /&gt;
    print(&amp;quot;in a_func d_var =&amp;quot;, d_var)&lt;br /&gt;
    print(&amp;quot;in a_func e_var =&amp;quot;, e_var)&lt;br /&gt;
    return b_var + 10&lt;br /&gt;
&lt;br /&gt;
c_var = a_func(b_var)&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;a_var =&amp;quot;, a_var)&lt;br /&gt;
print(&amp;quot;b_var =&amp;quot;, b_var)&lt;br /&gt;
print(&amp;quot;c_var =&amp;quot;, c_var)&lt;br /&gt;
print(&amp;quot;d_var =&amp;quot;, d_var)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
output:&lt;br /&gt;
&lt;br /&gt;
 in a_func a_var =  15&lt;br /&gt;
 in a_func b_var =  115&lt;br /&gt;
 in a_func d_var =  30&lt;br /&gt;
 in a_func e_var =  25&lt;br /&gt;
 a_var =  10&lt;br /&gt;
 b_var =  15&lt;br /&gt;
 c_var =  125&lt;br /&gt;
 d_var = &lt;br /&gt;
 &lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
  File &amp;quot;C:\def2.py&amp;quot;, line 19, in &amp;lt;module&amp;gt;&lt;br /&gt;
    print(&amp;quot;d_var = &amp;quot;, d_var)&lt;br /&gt;
 NameError: name 'd_var' is not defined&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this example the variables &amp;lt;code&amp;gt;a_var&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;b_var&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;d_var&amp;lt;/code&amp;gt; are all local variables when they are inside the function &amp;lt;code&amp;gt;a_func&amp;lt;/code&amp;gt;.  After the statement &amp;lt;code&amp;gt;return b_var + 10&amp;lt;/code&amp;gt; is run, they all cease to exist. The variable &amp;lt;code&amp;gt;a_var&amp;lt;/code&amp;gt; is automatically a local variable since it is a parameter name.  The variables &amp;lt;code&amp;gt;b_var&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;d_var&amp;lt;/code&amp;gt; are local variables since they appear on the left of an equals sign in the function in the statements &amp;lt;code&amp;gt;b_var = 100 + a_var&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;d_var = 2 * a_var&amp;lt;/code&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Inside of the function &amp;lt;code&amp;gt;a_var&amp;lt;/code&amp;gt; has no value assigned to it.  When the function is called with &amp;lt;code&amp;gt;c_var = a_func(b_var)&amp;lt;/code&amp;gt;, 15 is assigned to &amp;lt;code&amp;gt;a_var&amp;lt;/code&amp;gt; since at that point in time &amp;lt;code&amp;gt;b_var&amp;lt;/code&amp;gt; is 15, making the call to the function &amp;lt;code&amp;gt;a_func(15)&amp;lt;/code&amp;gt;.  This ends up setting &amp;lt;code&amp;gt;a_var&amp;lt;/code&amp;gt; to 15 when it is inside of &amp;lt;code&amp;gt;a_func&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As you can see, once the function finishes running, the local variables&lt;br /&gt;
&amp;lt;code&amp;gt;a_var&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b_var&amp;lt;/code&amp;gt; that had hidden the global variables of the same name are gone.  Then the statement &amp;lt;code&amp;gt;print(&amp;quot;a_var = &amp;quot;, a_var)&amp;lt;/code&amp;gt; prints the value &amp;lt;code&amp;gt;10&amp;lt;/code&amp;gt; rather than the value &amp;lt;code&amp;gt;15&amp;lt;/code&amp;gt; since the local variable &lt;br /&gt;
that hid the global variable is gone.  &lt;br /&gt;
&lt;br /&gt;
Another thing to notice is the &amp;lt;code&amp;gt;NameError&amp;lt;/code&amp;gt; that happens at the end.  This appears since the variable &amp;lt;code&amp;gt;d_var&amp;lt;/code&amp;gt; no longer exists since &amp;lt;code&amp;gt;a_func&amp;lt;/code&amp;gt; finished.  All the local variables are deleted when the function exits.  If you want to get something from a function, then you will have to use &amp;lt;code&amp;gt;return something&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One last thing to notice is that the value of &amp;lt;code&amp;gt;e_var&amp;lt;/code&amp;gt; remains unchanged inside &amp;lt;code&amp;gt;a_func&amp;lt;/code&amp;gt; since it is not a parameter and it never appears on the left of an equals sign inside of the function &amp;lt;code&amp;gt;a_func&amp;lt;/code&amp;gt;.  When a global variable is accessed inside a function it is the global variable from the outside.&lt;br /&gt;
&lt;br /&gt;
Functions allow local variables that exist only inside the function and &lt;br /&gt;
can hide other variables that are outside the function.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
'''temperature2.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#! /usr/bin/python&lt;br /&gt;
#-*-coding: utf-8 -*-&lt;br /&gt;
# converts temperature to Fahrenheit or Celsius&lt;br /&gt;
 &lt;br /&gt;
def print_options():&lt;br /&gt;
    print(&amp;quot;Options:&amp;quot;)&lt;br /&gt;
    print(&amp;quot; 'p' print options&amp;quot;)&lt;br /&gt;
    print(&amp;quot; 'c' convert from Celsius&amp;quot;)&lt;br /&gt;
    print(&amp;quot; 'f' convert from Fahrenheit&amp;quot;)&lt;br /&gt;
    print(&amp;quot; 'q' quit the program&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
def celsius_to_fahrenheit(c_temp):&lt;br /&gt;
    return 9.0 / 5.0 * c_temp + 32&lt;br /&gt;
 &lt;br /&gt;
def fahrenheit_to_celsius(f_temp):&lt;br /&gt;
    return (f_temp - 32.0) * 5.0 / 9.0&lt;br /&gt;
 &lt;br /&gt;
choice = &amp;quot;p&amp;quot;&lt;br /&gt;
while choice != &amp;quot;q&amp;quot;:&lt;br /&gt;
    if choice == &amp;quot;c&amp;quot;:&lt;br /&gt;
        c_temp = float(input(&amp;quot;Celsius temperature: &amp;quot;))&lt;br /&gt;
        print(&amp;quot;Fahrenheit:&amp;quot;, celsius_to_fahrenheit(c_temp))&lt;br /&gt;
        choice = input(&amp;quot;option: &amp;quot;)&lt;br /&gt;
    elif choice == &amp;quot;f&amp;quot;:&lt;br /&gt;
        f_temp = float(input(&amp;quot;Fahrenheit temperature: &amp;quot;))&lt;br /&gt;
        print(&amp;quot;Celsius:&amp;quot;, fahrenheit_to_celsius(f_temp))&lt;br /&gt;
        choice = input(&amp;quot;option: &amp;quot;)&lt;br /&gt;
    else:&lt;br /&gt;
        choice = &amp;quot;p&amp;quot;    #Alternatively choice != &amp;quot;q&amp;quot;: so that print &lt;br /&gt;
                        #when anything unexpected inputed&lt;br /&gt;
        print_options()&lt;br /&gt;
        choice = input(&amp;quot;option: &amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample Run:&lt;br /&gt;
&lt;br /&gt;
 Options:&lt;br /&gt;
  'p' print options&lt;br /&gt;
  'c' convert from celsius&lt;br /&gt;
  'f' convert from fahrenheit&lt;br /&gt;
  'q' quit the program&lt;br /&gt;
 option: '''c'''&lt;br /&gt;
 Celsius temperature: '''30''' &lt;br /&gt;
 Fahrenheit: 86.0&lt;br /&gt;
 option: '''f'''&lt;br /&gt;
 Fahrenheit temperature: '''60'''&lt;br /&gt;
 Celsius: 15.5555555556&lt;br /&gt;
 option: '''q'''&lt;br /&gt;
&lt;br /&gt;
'''area2.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#! /usr/bin/python&lt;br /&gt;
#-*-coding: utf-8 -*-&lt;br /&gt;
# calculates a given rectangle area&lt;br /&gt;
&lt;br /&gt;
def hello():&lt;br /&gt;
    print('Hello!')&lt;br /&gt;
 &lt;br /&gt;
def area(width, height):&lt;br /&gt;
    return width * height&lt;br /&gt;
 &lt;br /&gt;
def print_welcome(name):&lt;br /&gt;
    print('Welcome,', name)&lt;br /&gt;
 &lt;br /&gt;
def positive_input(prompt):&lt;br /&gt;
    number = float(input(prompt))&lt;br /&gt;
    while number &amp;lt;= 0:&lt;br /&gt;
        print('Must be a positive number')&lt;br /&gt;
        number = float(input(prompt))&lt;br /&gt;
    return number&lt;br /&gt;
 &lt;br /&gt;
name = input('Your Name: ')&lt;br /&gt;
hello()&lt;br /&gt;
print_welcome(name)&lt;br /&gt;
print()&lt;br /&gt;
print('To find the area of a rectangle,')&lt;br /&gt;
print('enter the width and height below.')&lt;br /&gt;
print()&lt;br /&gt;
w = positive_input('Width: ')&lt;br /&gt;
h = positive_input('Height: ')&lt;br /&gt;
 &lt;br /&gt;
print('Width =', w, ' Height =', h, ' so Area =', area(w, h))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample Run:&lt;br /&gt;
&lt;br /&gt;
 Your Name: '''Josh'''&lt;br /&gt;
 Hello!&lt;br /&gt;
 Welcome, Josh&lt;br /&gt;
 &lt;br /&gt;
 To find the area of a rectangle,&lt;br /&gt;
 enter the width and height below.&lt;br /&gt;
 &lt;br /&gt;
 Width: '''-4'''&lt;br /&gt;
 Must be a positive number&lt;br /&gt;
 Width: '''4'''&lt;br /&gt;
 Height: '''3'''&lt;br /&gt;
 Width = 4  Height = 3  so Area = 12&lt;br /&gt;
&lt;br /&gt;
=== Exercises ===&lt;br /&gt;
Rewrite the area2.py program from the Examples above to have a separate function for the area of a square, the area of a rectangle, and the area of a circle (&amp;lt;code&amp;gt;3.14 * radius**2&amp;lt;/code&amp;gt;). This program should include a menu interface.&lt;br /&gt;
&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def square(L):&lt;br /&gt;
    return L * L&lt;br /&gt;
&lt;br /&gt;
def rectangle(width , height):&lt;br /&gt;
    return width * height&lt;br /&gt;
&lt;br /&gt;
def circle(radius):&lt;br /&gt;
    return 3.14159 * radius ** 2&lt;br /&gt;
&lt;br /&gt;
def options():&lt;br /&gt;
    print()&lt;br /&gt;
    print(&amp;quot;Options:&amp;quot;)&lt;br /&gt;
    print(&amp;quot;s = calculate the area of a square.&amp;quot;)&lt;br /&gt;
    print(&amp;quot;c = calculate the area of a circle.&amp;quot;)&lt;br /&gt;
    print(&amp;quot;r = calculate the area of a rectangle.&amp;quot;)&lt;br /&gt;
    print(&amp;quot;q = quit&amp;quot;)&lt;br /&gt;
    print()&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;This program will calculate the area of a square, circle or rectangle.&amp;quot;)&lt;br /&gt;
choice = &amp;quot;x&amp;quot;&lt;br /&gt;
options()&lt;br /&gt;
while choice != &amp;quot;q&amp;quot;:&lt;br /&gt;
    choice = input(&amp;quot;Please enter your choice: &amp;quot;)&lt;br /&gt;
    if choice == &amp;quot;s&amp;quot;:&lt;br /&gt;
        L = float(input(&amp;quot;Length of square side: &amp;quot;))&lt;br /&gt;
        print(&amp;quot;The area of this square is&amp;quot;, square(L))&lt;br /&gt;
        options()&lt;br /&gt;
    elif choice == &amp;quot;c&amp;quot;:&lt;br /&gt;
        radius = float(input(&amp;quot;Radius of the circle: &amp;quot;))&lt;br /&gt;
        print(&amp;quot;The area of the circle is&amp;quot;, circle(radius))&lt;br /&gt;
        options()&lt;br /&gt;
    elif choice == &amp;quot;r&amp;quot;:&lt;br /&gt;
        width = float(input(&amp;quot;Width of the rectangle: &amp;quot;))&lt;br /&gt;
        height = float(input(&amp;quot;Height of the rectangle: &amp;quot;))&lt;br /&gt;
        print(&amp;quot;The area of the rectangle is&amp;quot;, rectangle(width, height))&lt;br /&gt;
        options()&lt;br /&gt;
    elif choice == &amp;quot;q&amp;quot;:&lt;br /&gt;
        print(&amp;quot; &amp;quot;,end=&amp;quot;&amp;quot;)&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Unrecognized option.&amp;quot;)&lt;br /&gt;
        options()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Debugging |next=Advanced Functions Example}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Derinimas&amp;diff=3024</id>
		<title>Python Vadovėlis/Derinimas</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Derinimas&amp;diff=3024"/>
		<updated>2021-09-13T10:31:04Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== What is debugging? ===&lt;br /&gt;
:&amp;quot;As soon as we started programming, we found to our surprise that it wasn't as easy  to get programs right as we had thought.  Debugging had to be discovered.  I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.&amp;quot; &amp;amp;mdash; ''Maurice Wilkes discovers debugging'', 1949&lt;br /&gt;
&lt;br /&gt;
By now if you have been messing around with the programs you have probably found that sometimes the program does something you didn't want it to do.  This is fairly common.  Debugging is the process of figuring out what the computer is doing and then getting it to do what you want it to do.  This can be tricky.  I once spent nearly a week tracking down and fixing a bug that was caused by someone putting an &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; where a &amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt; should have been.  &lt;br /&gt;
&lt;br /&gt;
This chapter will be more abstract than previous chapters.&lt;br /&gt;
&lt;br /&gt;
=== What should the program do? ===&lt;br /&gt;
&lt;br /&gt;
The first thing to do (this sounds obvious) is to figure out what the&lt;br /&gt;
program should be doing if it is running correctly.  Come up with some&lt;br /&gt;
test cases and see what happens.  For example, let's say I have a&lt;br /&gt;
program to compute the perimeter of a rectangle (the sum of the length&lt;br /&gt;
of all the edges).  I have the following test cases:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!height !! width !!perimeter&lt;br /&gt;
|-&lt;br /&gt;
|3 ||4 ||14&lt;br /&gt;
|--&lt;br /&gt;
|2 ||3 ||10&lt;br /&gt;
|-&lt;br /&gt;
|4 ||4 ||16&lt;br /&gt;
|-&lt;br /&gt;
|2 ||2 ||8&lt;br /&gt;
|-&lt;br /&gt;
|5 ||1 ||12&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
I now run my program on all of the test cases and see if the program does what &lt;br /&gt;
I expect it to do.  If it doesn't then I need to find out what the computer is&lt;br /&gt;
doing.&lt;br /&gt;
&lt;br /&gt;
More commonly some of the test cases will work and some will not.  If that is the case you should try and figure out what the working ones have in common. &lt;br /&gt;
For example here is the output for a perimeter program (you get to see the code in a minute):&lt;br /&gt;
&lt;br /&gt;
 Height: '''3'''&lt;br /&gt;
 Width: '''4'''&lt;br /&gt;
 perimeter = 15&lt;br /&gt;
&lt;br /&gt;
 Height: '''2'''&lt;br /&gt;
 Width: '''3'''&lt;br /&gt;
 perimeter = 11&lt;br /&gt;
&lt;br /&gt;
 Height: '''4'''&lt;br /&gt;
 Width: '''4'''&lt;br /&gt;
 perimeter = 16&lt;br /&gt;
&lt;br /&gt;
 Height: '''2'''&lt;br /&gt;
 Width: '''2'''&lt;br /&gt;
 perimeter = 8&lt;br /&gt;
&lt;br /&gt;
 Height: '''5'''&lt;br /&gt;
 Width: '''1'''&lt;br /&gt;
 perimeter = 8&lt;br /&gt;
&lt;br /&gt;
Notice that it didn't work for the first two inputs, it worked for the next&lt;br /&gt;
two and it didn't work on the last one.  Try and figure out what is in common &lt;br /&gt;
with the working ones.  Once you have some idea what the problem is finding the&lt;br /&gt;
cause is easier.  With your own programs you should try more test cases if you need them.&lt;br /&gt;
&lt;br /&gt;
=== What does the program do? ===&lt;br /&gt;
&lt;br /&gt;
The next thing to do is to look at the source code.  One of the most important things to do while programming is reading source code.  The primary way to do this is code walkthroughs.  &lt;br /&gt;
&lt;br /&gt;
A code walkthrough starts at the first line, and works its way down until the program is done.  &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; loops and &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statements mean that some lines may never be run and some lines are run many times.  At each line you figure out what Python has done.&lt;br /&gt;
&lt;br /&gt;
Lets start with the simple perimeter program.  Don't type it in, you are going to read it, not run it.  The source code is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
height = int(input(&amp;quot;Height: &amp;quot;))&lt;br /&gt;
width = int(input(&amp;quot;Width: &amp;quot;))&lt;br /&gt;
print(&amp;quot;perimeter =&amp;quot;, width + height + width + width)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; ''Question:'' What is the first line Python runs?&lt;br /&gt;
: ''Answer:'' The first line is always run first.  In this case it is: &amp;lt;code&amp;gt;height = int(input(&amp;quot;Height: &amp;quot;))&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does that line do?&lt;br /&gt;
: Prints &amp;lt;code&amp;gt; Height: &amp;lt;/code&amp;gt;, waits for the user to type a string in, and then converts the string to an integer variable height.&lt;br /&gt;
; What is the next line that runs?&lt;br /&gt;
: In general, it is the next line down which is: &amp;lt;code&amp;gt;width = int(input(&amp;quot;Width: &amp;quot;))&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does that line do?&lt;br /&gt;
: Prints &amp;lt;code&amp;gt;Width: &amp;lt;/code&amp;gt;, waits for the user to type a number in, and puts what the user types in the variable width.&lt;br /&gt;
; What is the next line that runs?&lt;br /&gt;
: When the next line is not indented more or less than the current line, it is the line right afterwards, so it is: &amp;lt;code&amp;gt;print(&amp;quot;perimeter = &amp;quot;, width + height + width + width)&amp;lt;/code&amp;gt; (It may also run a function in the current line, but that's a future chapter.)                                                                       &lt;br /&gt;
; What does that line do?&lt;br /&gt;
: First it prints &amp;lt;code&amp;gt;perimeter = &amp;lt;/code&amp;gt;, then it prints the sum of the values contained within the variables, &amp;lt;code&amp;gt;width&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;height&amp;lt;/code&amp;gt;, from &amp;lt;code&amp;gt;width + height + width + width&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Does &amp;lt;code&amp;gt;width + height + width + width&amp;lt;/code&amp;gt; calculate the perimeter properly?&lt;br /&gt;
: Let's see, perimeter of a rectangle is the bottom (width) plus the left side (height) plus the top (width) plus the right side (huh?). The last item should be the right side's length, or the height.&lt;br /&gt;
; Do you understand why some of the times the perimeter was calculated &amp;quot;correctly&amp;quot;?                                                                             &lt;br /&gt;
: It was calculated correctly when the width and the height were equal.&lt;br /&gt;
&lt;br /&gt;
The next program we will do a code walkthrough for is a program that is supposed to print out 5 dots on the screen.  However, this is what the program is outputting:&lt;br /&gt;
&lt;br /&gt;
 . . . . &lt;br /&gt;
&lt;br /&gt;
And here is the program:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
number = 5&lt;br /&gt;
while number &amp;gt; 1:&lt;br /&gt;
    print(&amp;quot;.&amp;quot;,end=&amp;quot; &amp;quot;)&lt;br /&gt;
    number = number - 1&lt;br /&gt;
print()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This program will be more complex to walkthrough since it now has indented portions (or control structures).  Let us begin.&lt;br /&gt;
; What is the first line to be run?&lt;br /&gt;
: The first line of the file: &amp;lt;code&amp;gt;number = 5&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: Puts the number 5 in the variable number.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: The next line is: &amp;lt;code&amp;gt;while number &amp;gt; 1:&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: Well, &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; statements in general look at their expression, and if it is true they do the next indented block of code, otherwise they skip the next indented block of code.&lt;br /&gt;
; So what does it do right now?&lt;br /&gt;
: If &amp;lt;code&amp;gt;number &amp;gt; 1&amp;lt;/code&amp;gt; is true then the next two lines will be run.&lt;br /&gt;
; So is &amp;lt;code&amp;gt;number &amp;gt; 1&amp;lt;/code&amp;gt;?&lt;br /&gt;
: The last value put into &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; was &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;5 &amp;gt; 1&amp;lt;/code&amp;gt; so yes.&lt;br /&gt;
; So what is the next line?&lt;br /&gt;
: Since the &amp;lt;code&amp;gt; while&amp;lt;/code&amp;gt; was true the next line is: &amp;lt;code&amp;gt;print(&amp;quot;.&amp;quot;,end=&amp;quot; &amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does that line do?&lt;br /&gt;
: Prints one dot and since the extra argument &amp;lt;code&amp;gt;end=&amp;quot; &amp;quot;&amp;lt;/code&amp;gt; exists the next printed text will not be on a different screen line.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: &amp;lt;code&amp;gt;number = number - 1&amp;lt;/code&amp;gt; since that is following line and there are no indent changes.&lt;br /&gt;
; What does it do?&lt;br /&gt;
: It calculates &amp;lt;code&amp;gt;number - 1&amp;lt;/code&amp;gt;, which is the current value of &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; (or 5) subtracts 1 from it, and makes that the new value of number.  So basically it changes &amp;lt;code&amp;gt; number&amp;lt;/code&amp;gt;'s value from 5 to 4.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: Well, the indent level decreases so we have to look at what type of control structure it is.  It is a &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; loop, so we have to go back to the &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; clause which is &amp;lt;code&amp;gt;while number &amp;gt; 1:&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: It looks at the value of number, which is 4, and compares it to 1 and since &amp;lt;code&amp;gt;4 &amp;gt; 1&amp;lt;/code&amp;gt; the while loop continues.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: Since the while loop was true, the next line is: &amp;lt;code&amp;gt;print(&amp;quot;.&amp;quot;,end=&amp;quot; &amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: It prints a second dot on the line, ending by a space.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: No indent change so it is: &amp;lt;code&amp;gt;number = number - 1&amp;lt;/code&amp;gt;&lt;br /&gt;
; And what does it do?&lt;br /&gt;
: It takes the current value of number (4), subtracts 1 from it, which gives it 3 and then finally makes 3 the new value of number.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: Since there is an indent change caused by the end of the while loop, the next line is: &amp;lt;code&amp;gt;while number &amp;gt; 1:&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: It compares the current value of number (3) to 1. &amp;lt;code&amp;gt;3 &amp;gt; 1&amp;lt;/code&amp;gt; so the while loop continues.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: Since the while loop condition was true the next line is: &amp;lt;code&amp;gt;print(&amp;quot;.&amp;quot;,end=&amp;quot; &amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
; And it does what?&lt;br /&gt;
: A third dot is printed on the line.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: It is: &amp;lt;code&amp;gt;number = number - 1&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: It takes the current value of number (3) subtracts from it 1 and makes the 2 the new value of number.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: Back up to the start of the while loop: &amp;lt;code&amp;gt;while number &amp;gt; 1:&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: It compares the current value of number (2) to 1.  Since &amp;lt;code&amp;gt;2 &amp;gt; 1&amp;lt;/code&amp;gt; the while loop continues.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: Since the while loop is continuing: &amp;lt;code&amp;gt;print(&amp;quot;.&amp;quot;,end=&amp;quot; &amp;quot;)&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: It discovers the meaning of life, the universe and everything.  I'm joking. (I had to make sure you were awake.)  The line prints a fourth dot on the screen.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: It's: &amp;lt;code&amp;gt;number = number - 1&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does it do?&lt;br /&gt;
: Takes the current value of number (2) subtracts 1 and makes 1 the new value of number.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: Back up to the while loop: &amp;lt;code&amp;gt;while number &amp;gt; 1:&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does the line do?&lt;br /&gt;
: It compares the current value of number (1) to 1. Since &amp;lt;code&amp;gt;1 &amp;gt; 1&amp;lt;/code&amp;gt; is false (one is not greater than one), the while loop exits.&lt;br /&gt;
; What is the next line?&lt;br /&gt;
: Since the while loop condition was false the next line is the line after the while loop exits, or: &amp;lt;code&amp;gt;print()&amp;lt;/code&amp;gt;&lt;br /&gt;
; What does that line do?&lt;br /&gt;
: Makes the screen go to the next line.&lt;br /&gt;
; Why doesn't the program print 5 dots?&lt;br /&gt;
: The loop exits 1 dot too soon.&lt;br /&gt;
; How can we fix that?&lt;br /&gt;
: Make the loop exit 1 dot later.&lt;br /&gt;
; And how do we do that?&lt;br /&gt;
: There are several ways.  One way would be to change the while loop to: &amp;lt;code&amp;gt;while number &amp;gt; 0:&amp;lt;/code&amp;gt;  Another way would be to change the conditional to: &amp;lt;code&amp;gt;number &amp;gt;= 1&amp;lt;/code&amp;gt;  There are a couple others.&lt;br /&gt;
&lt;br /&gt;
=== How do I fix my program? ===&lt;br /&gt;
&lt;br /&gt;
You need to figure out what the program is doing.  You need to figure out what the program should do.  Figure out what the difference between the two is.  Debugging is a skill that has to be practiced to be learned. If you can't figure it out after an hour, take a break, talk to someone about the problem or contemplate the lint in your navel.  Come back in a while and you will probably have new ideas about the problem.  Good luck.&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Decisions |next=Defining Functions}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Pasirinkimai&amp;diff=3023</id>
		<title>Python Vadovėlis/Pasirinkimai</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Pasirinkimai&amp;diff=3023"/>
		<updated>2021-09-13T10:30:52Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== If statement ===&lt;br /&gt;
As always, I believe I should start each chapter with a warm-up typing exercise, so here is a short program to compute the absolute value of an integer:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
n = int(input(&amp;quot;Number? &amp;quot;))&lt;br /&gt;
if n &amp;lt; 0:&lt;br /&gt;
   print(&amp;quot;The absolute value of&amp;quot;, n, &amp;quot;is&amp;quot;, -n)&lt;br /&gt;
else:&lt;br /&gt;
   print(&amp;quot;The absolute value of&amp;quot;, n, &amp;quot;is&amp;quot;, n)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the output from the two times that I ran this program:&lt;br /&gt;
&lt;br /&gt;
 Number? '''-34'''&lt;br /&gt;
 The absolute value of -34 is 34&lt;br /&gt;
&lt;br /&gt;
 Number? '''1'''&lt;br /&gt;
 The absolute value of 1 is 1&lt;br /&gt;
&lt;br /&gt;
So what does the computer do when it sees this piece of code?  First it prompts the user for a number with the statement &amp;quot;&amp;lt;code&amp;gt;n = int(input(&amp;quot;Number? &amp;quot;))&amp;lt;/code&amp;gt;&amp;quot;.  Next it reads the line &amp;quot;&amp;lt;code&amp;gt;if n &amp;lt; 0:&amp;lt;/code&amp;gt;&amp;quot;. If &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; is less than zero Python runs the line &amp;quot;&amp;lt;code&amp;gt;print(&amp;quot;The absolute value of&amp;quot;, n, &amp;quot;is&amp;quot;, -n)&amp;lt;/code&amp;gt;&amp;quot;. Otherwise it runs the line &amp;quot;&amp;lt;code&amp;gt;print(&amp;quot;The absolute value of&amp;quot;, n, &amp;quot;is&amp;quot;, n)&amp;lt;/code&amp;gt;&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
More formally Python looks at whether the ''expression'' &amp;lt;code&amp;gt;n &amp;lt; 0&amp;lt;/code&amp;gt; is true or false.  An &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement is followed by an indented ''block'' of statements that are run when the expression is true.  Optionally after the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement is an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement and another indented ''block'' of statements.  This second block of statements is run if the expression is false.  &lt;br /&gt;
&lt;br /&gt;
There are a number of different tests that an expression can have.  Here is a table of all of them:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!operator &lt;br /&gt;
!function&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;&amp;lt;/code&amp;gt; &lt;br /&gt;
|less than&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;lt;=&amp;lt;/code&amp;gt; &lt;br /&gt;
|less than or equal to&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
|greater than&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;gt;=&amp;lt;/code&amp;gt; &lt;br /&gt;
|greater than or equal to&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;==&amp;lt;/code&amp;gt; &lt;br /&gt;
|equal&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;!=&amp;lt;/code&amp;gt; &lt;br /&gt;
|not equal&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Another feature of the &amp;lt;code&amp;gt; if&amp;lt;/code&amp;gt; command is the &amp;lt;code&amp;gt; elif &amp;lt;/code&amp;gt; statement.  It stands for else if and means if the original &amp;lt;code&amp;gt; if&amp;lt;/code&amp;gt; statement is false but the &amp;lt;code&amp;gt; elif&amp;lt;/code&amp;gt; part is true, then do the &amp;lt;code&amp;gt;elif&amp;lt;/code&amp;gt; part. And if neither the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;elif&amp;lt;/code&amp;gt; expressions are true, then do what's in the &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; block. Here's an example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 0&lt;br /&gt;
while a &amp;lt; 10:&lt;br /&gt;
    a = a + 1&lt;br /&gt;
    if a &amp;gt; 5:&lt;br /&gt;
        print(a, &amp;quot;&amp;gt;&amp;quot;, 5)&lt;br /&gt;
    elif a &amp;lt;= 3:&lt;br /&gt;
        print(a, &amp;quot;&amp;lt;=&amp;quot;, 3)&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Neither test was true&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the output:&lt;br /&gt;
&lt;br /&gt;
 1 &amp;lt;= 3&lt;br /&gt;
 2 &amp;lt;= 3&lt;br /&gt;
 3 &amp;lt;= 3&lt;br /&gt;
 Neither test was true&lt;br /&gt;
 Neither test was true&lt;br /&gt;
 6 &amp;gt; 5&lt;br /&gt;
 7 &amp;gt; 5&lt;br /&gt;
 8 &amp;gt; 5&lt;br /&gt;
 9 &amp;gt; 5&lt;br /&gt;
 10 &amp;gt; 5&lt;br /&gt;
&lt;br /&gt;
Notice how the &amp;lt;code&amp;gt;elif a &amp;lt;= 3&amp;lt;/code&amp;gt; is only tested when the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement fails to be true. There can be more than one &amp;lt;code&amp;gt;elif&amp;lt;/code&amp;gt; expression, allowing multiple tests to be done in a single &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# This Program Demonstrates the use of the == operator&lt;br /&gt;
# using numbers&lt;br /&gt;
print(5 == 6)&lt;br /&gt;
# Using variables&lt;br /&gt;
x = 5&lt;br /&gt;
y = 8&lt;br /&gt;
print(x == y)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the output&lt;br /&gt;
&lt;br /&gt;
 False&lt;br /&gt;
 False&lt;br /&gt;
&lt;br /&gt;
'''high_low.py'''&amp;lt;!--\label{firsthighlow}--&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Plays the guessing game higher or lower &lt;br /&gt;
&lt;br /&gt;
# This should actually be something that is semi random like the&lt;br /&gt;
# last digits of the time or something else, but that will have to&lt;br /&gt;
# wait till a later chapter.  (Extra Credit, modify it to be random&lt;br /&gt;
# after the Modules chapter)&lt;br /&gt;
number = 7&lt;br /&gt;
guess = -1&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;Guess the number!&amp;quot;)&lt;br /&gt;
while guess != number:&lt;br /&gt;
    guess = int(input(&amp;quot;Is it... &amp;quot;))&lt;br /&gt;
&lt;br /&gt;
    if guess == number:&lt;br /&gt;
        print(&amp;quot;Hooray! You guessed it right!&amp;quot;)&lt;br /&gt;
    elif guess &amp;lt; number:&lt;br /&gt;
        print(&amp;quot;It's bigger...&amp;quot;)&lt;br /&gt;
    elif guess &amp;gt; number:&lt;br /&gt;
        print(&amp;quot;It's not so big.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample run:&lt;br /&gt;
&lt;br /&gt;
 Guess the number!&lt;br /&gt;
 Is it... '''2'''&lt;br /&gt;
 It's bigger...&lt;br /&gt;
 Is it... '''5'''&lt;br /&gt;
 It's bigger...&lt;br /&gt;
 Is it... '''10'''&lt;br /&gt;
 It's not so big.&lt;br /&gt;
 Is it... '''7'''&lt;br /&gt;
 Hooray! You guessed it right!&lt;br /&gt;
&lt;br /&gt;
'''even.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Asks for a number.&lt;br /&gt;
# Prints if it is even or odd&lt;br /&gt;
 &lt;br /&gt;
number = float(input(&amp;quot;Tell me a number: &amp;quot;))&lt;br /&gt;
if number % 2 == 0:&lt;br /&gt;
    print(int(number), &amp;quot;is even.&amp;quot;)&lt;br /&gt;
elif number % 2 == 1:&lt;br /&gt;
    print(int(number), &amp;quot;is odd.&amp;quot;)&lt;br /&gt;
else:&lt;br /&gt;
    print(number, &amp;quot;is very strange.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample runs:&lt;br /&gt;
&lt;br /&gt;
 Tell me a number: '''3'''&lt;br /&gt;
 3 is odd.&lt;br /&gt;
&lt;br /&gt;
 Tell me a number: '''2'''&lt;br /&gt;
 2 is even.&lt;br /&gt;
&lt;br /&gt;
 Tell me a number: '''3.4895'''&lt;br /&gt;
 3.4895 is very strange.&lt;br /&gt;
&lt;br /&gt;
'''average1.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# keeps asking for numbers until 0 is entered.&lt;br /&gt;
# Prints the average value.&lt;br /&gt;
&lt;br /&gt;
count = 0&lt;br /&gt;
sum = 0.0&lt;br /&gt;
number = 1 # set to something that will not exit the while loop immediately.&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;Enter 0 to exit the loop&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
while number != 0:&lt;br /&gt;
    number = float(input(&amp;quot;Enter a number: &amp;quot;))&lt;br /&gt;
    if number != 0:&lt;br /&gt;
        count = count + 1&lt;br /&gt;
        sum = sum + number&lt;br /&gt;
    if number == 0:&lt;br /&gt;
        print(&amp;quot;The average was:&amp;quot;, sum / count)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{Solution|title=Sample runs|text=&lt;br /&gt;
Sample runs:&lt;br /&gt;
&lt;br /&gt;
 Enter 0 to exit the loop&lt;br /&gt;
 Enter a number: '''3'''&lt;br /&gt;
 Enter a number: '''5'''&lt;br /&gt;
 Enter a number: '''0'''&lt;br /&gt;
 The average was: 4.0&lt;br /&gt;
&lt;br /&gt;
 Enter 0 to exit the loop&lt;br /&gt;
 Enter a number: '''1'''&lt;br /&gt;
 Enter a number: '''4'''&lt;br /&gt;
 Enter a number: '''3'''&lt;br /&gt;
 Enter a number: '''0'''&lt;br /&gt;
 The average was: 2.66666666667&lt;br /&gt;
}}&lt;br /&gt;
'''average2.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# keeps asking for numbers until count numbers have been entered.&lt;br /&gt;
# Prints the average value.&lt;br /&gt;
&lt;br /&gt;
#Notice that we use an integer to keep track of how many numbers, &lt;br /&gt;
# but floating point numbers for the input of each number&lt;br /&gt;
sum = 0.0&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;This program will take several numbers then average them&amp;quot;)&lt;br /&gt;
count = int(input(&amp;quot;How many numbers would you like to average: &amp;quot;))&lt;br /&gt;
current_count = 0&lt;br /&gt;
&lt;br /&gt;
while current_count &amp;lt; count:&lt;br /&gt;
    current_count = current_count + 1&lt;br /&gt;
    print(&amp;quot;Number&amp;quot;, current_count)&lt;br /&gt;
    number = float(input(&amp;quot;Enter a number: &amp;quot;))&lt;br /&gt;
    sum = sum + number&lt;br /&gt;
    &lt;br /&gt;
print(&amp;quot;The average was:&amp;quot;, sum / count)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample runs:&lt;br /&gt;
&lt;br /&gt;
 This program will take several numbers then average them&lt;br /&gt;
 How many numbers would you like to average: '''2'''&lt;br /&gt;
 Number 1&lt;br /&gt;
 Enter a number: '''3'''&lt;br /&gt;
 Number 2&lt;br /&gt;
 Enter a number: '''5'''&lt;br /&gt;
 The average was: 4.0&lt;br /&gt;
&lt;br /&gt;
 This program will take several numbers then average them&lt;br /&gt;
 How many numbers would you like to average: '''3'''&lt;br /&gt;
 Number 1&lt;br /&gt;
 Enter a number: '''1'''&lt;br /&gt;
 Number 2&lt;br /&gt;
 Enter a number: '''4'''&lt;br /&gt;
 Number 3&lt;br /&gt;
 Enter a number: '''3'''&lt;br /&gt;
 The average was: 2.66666666667&lt;br /&gt;
&amp;lt;!-- TODO: add another example --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercises ===&lt;br /&gt;
Write a program that asks the user their name, if they enter your name&lt;br /&gt;
say &amp;quot;That is a nice name&amp;quot;, if they enter &amp;quot;John Cleese&amp;quot; or &amp;quot;Michael&lt;br /&gt;
Palin&amp;quot;, tell them how you feel about them ;), otherwise tell them &amp;quot;You&lt;br /&gt;
have a nice name.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
name = input('Your name: ')&lt;br /&gt;
if name == 'Bryn':&lt;br /&gt;
    print('That is a nice name.')&lt;br /&gt;
elif name == 'John Cleese':&lt;br /&gt;
    print('... some funny text.')&lt;br /&gt;
elif name == 'Michael Palin':&lt;br /&gt;
    print('... some funny text.')&lt;br /&gt;
else:&lt;br /&gt;
    print('You have a nice name.')&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Modify the higher or lower program from this section to keep track of how many times the user has entered the wrong number.  If it is more than 3 times, print &amp;quot;That must have been complicated.&amp;quot; at the end, otherwise print &amp;quot;Good job!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
number = 7&lt;br /&gt;
guess = -1&lt;br /&gt;
count = 0&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;Guess the number!&amp;quot;)&lt;br /&gt;
while guess != number:&lt;br /&gt;
    guess = int(input(&amp;quot;Is it... &amp;quot;))&lt;br /&gt;
    count = count + 1&lt;br /&gt;
    if guess == number:&lt;br /&gt;
        print(&amp;quot;Hooray! You guessed it right!&amp;quot;)&lt;br /&gt;
    elif guess &amp;lt; number:&lt;br /&gt;
        print(&amp;quot;It's bigger...&amp;quot;)&lt;br /&gt;
    elif guess &amp;gt; number:&lt;br /&gt;
        print(&amp;quot;It's not so big.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
if count &amp;gt; 3:&lt;br /&gt;
    print(&amp;quot;That must have been complicated.&amp;quot;)&lt;br /&gt;
else:&lt;br /&gt;
    print(&amp;quot;Good job!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Write a program that asks for two numbers.  If the sum of the numbers &lt;br /&gt;
is greater than 100, print &amp;quot;That is a big number.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
number1 = float(input('1st number: '))&lt;br /&gt;
number2 = float(input('2nd number: '))&lt;br /&gt;
if number1 + number2 &amp;gt; 100:&lt;br /&gt;
    print('That is a big number.')&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Count to 10 |next=Debugging}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Suskai%C4%8Diuoti_iki_10&amp;diff=3022</id>
		<title>Python Vadovėlis/Suskaičiuoti iki 10</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Suskai%C4%8Diuoti_iki_10&amp;diff=3022"/>
		<updated>2021-09-13T10:30:37Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== While loops ===&lt;br /&gt;
Presenting our first ''control structure''.  Ordinarily the computer starts with the first line and then goes down from there.  Control structures change the order that statements are executed or decide if a certain statement will be run.  Here's the source for a program that uses the while control structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 0            # FIRST, set the initial value of the variable a to 0(zero).&lt;br /&gt;
while a &amp;lt; 10:    # While the value of the variable a is less than 10 do the following:&lt;br /&gt;
    a = a + 1    # Increase the value of the variable a by 1, as in: a = a + 1! &lt;br /&gt;
    print(a)     # Print to screen what the present value of the variable a is.&lt;br /&gt;
                 # REPEAT! until the value of the variable a is equal to 9!? See note. &lt;br /&gt;
                 &lt;br /&gt;
                 # NOTE:&lt;br /&gt;
                 # The value of the variable a will increase by 1&lt;br /&gt;
                 # with each repeat, or loop of the 'while statement BLOCK'.&lt;br /&gt;
                 # e.g. a = 1 then a = 2 then a = 3 etc. until a = 9 then...&lt;br /&gt;
                 # the code will finish adding 1 to a (now a = 10), printing the &lt;br /&gt;
                 # result, and then exiting the 'while statement BLOCK'. &lt;br /&gt;
                 #              --&lt;br /&gt;
                 # While a &amp;lt; 10: |&lt;br /&gt;
                 #     a = a + 1 |&amp;lt;--[ The while statement BLOCK ]&lt;br /&gt;
                 #     print (a) |&lt;br /&gt;
                 #              --&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And here is the extremely exciting output: &lt;br /&gt;
&lt;br /&gt;
 1&lt;br /&gt;
 2&lt;br /&gt;
 3&lt;br /&gt;
 4&lt;br /&gt;
 5&lt;br /&gt;
 6&lt;br /&gt;
 7&lt;br /&gt;
 8&lt;br /&gt;
 9&lt;br /&gt;
 10&lt;br /&gt;
&lt;br /&gt;
(And you thought it couldn't get any worse after turning your computer into a five-dollar calculator?)&lt;br /&gt;
&lt;br /&gt;
So what does the program do?  First it sees the line &amp;lt;code&amp;gt;a = 0&amp;lt;/code&amp;gt; and sets &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; to zero. Then it sees &amp;lt;code&amp;gt;while a &amp;lt; 10:&amp;lt;/code&amp;gt; and so the computer checks to see if &amp;lt;code&amp;gt;a &amp;lt; 10&amp;lt;/code&amp;gt;. The first time the computer sees this statement, &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; is zero, so it is less than 10. In other words, as long as &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; is less than ten, the computer will run the tabbed in statements. This eventually makes &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; equal to ten (by adding one to &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; again and again) and the &amp;lt;code&amp;gt;while a &amp;lt; 10&amp;lt;/code&amp;gt; is not true any longer. Reaching that point, the program will stop running the indented lines.&lt;br /&gt;
&lt;br /&gt;
Always remember to put a colon &amp;quot;''':'''&amp;quot; at the end of the &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; statement line!&lt;br /&gt;
&lt;br /&gt;
Here is another example of the use of &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 1&lt;br /&gt;
s = 0&lt;br /&gt;
print('Enter Numbers to add to the sum.')&lt;br /&gt;
print('Enter 0 to quit.')&lt;br /&gt;
while a != 0:                           &lt;br /&gt;
    print('Current Sum:', s)            &lt;br /&gt;
    a = float(input('Number? '))        &lt;br /&gt;
    s = s + a                            &lt;br /&gt;
print('Total Sum =', s)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Enter Numbers to add to the sum.&lt;br /&gt;
 Enter 0 to quit.&lt;br /&gt;
 Current Sum: 0&lt;br /&gt;
 Number? '''200'''&lt;br /&gt;
 Current Sum: 200.0&lt;br /&gt;
 Number? '''-15.25'''&lt;br /&gt;
 Current Sum: 184.75&lt;br /&gt;
 Number? '''-151.85'''&lt;br /&gt;
 Current Sum: 32.9&lt;br /&gt;
 Number? '''10.00'''&lt;br /&gt;
 Current Sum: 42.9&lt;br /&gt;
 Number? '''0'''&lt;br /&gt;
 Total Sum = 42.9&lt;br /&gt;
&lt;br /&gt;
Notice how &amp;lt;code&amp;gt;print('Total Sum =', s)&amp;lt;/code&amp;gt; is only run at the end. The &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; statement only affects the lines that are indented with whitespace. The &amp;lt;code&amp;gt;!=&amp;lt;/code&amp;gt; means does not equal so &amp;lt;code&amp;gt;while a != 0:&amp;lt;/code&amp;gt; means as long as &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; is not zero run the tabbed statements that follow. &lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; is a floating point number, and not all floating point numbers can be accurately represented, so using &amp;lt;code&amp;gt;!=&amp;lt;/code&amp;gt; on them can sometimes not work.  Try typing in 1.1 in interactive mode. &lt;br /&gt;
&lt;br /&gt;
==== Infinite loops or Never Ending Loop====&lt;br /&gt;
Now that we have while loops, it is possible to have programs that run forever. An easy way to do this is to write a program like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
while True:&lt;br /&gt;
   print(&amp;quot;Help, I'm stuck in a loop.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;==&amp;lt;/tt&amp;gt;&amp;quot; operator is used to test equality of the expressions on the two sides of the operator, just as &amp;quot;&amp;lt;tt&amp;gt;&amp;amp;lt;&amp;lt;/tt&amp;gt;&amp;quot; was used for &amp;quot;less than&amp;quot; before (you will get a complete list of all comparison operators in the next chapter).&lt;br /&gt;
&lt;br /&gt;
This program will output &amp;lt;code&amp;gt;Help, I'm stuck in a loop.&amp;lt;/code&amp;gt; until the heat death of the universe or you stop it, because 1 will forever be equal to 1.  The way to stop it is to hit the Control (or ''Ctrl'') button and ''C'' (the letter) at the same time.  This will kill the program.  (Note: sometimes you will have to hit enter after the Control-C.) On some systems, nothing will stop it, short of killing the process--so avoid!&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
==== Fibonacci sequence ====&lt;br /&gt;
'''Fibonacci-method1.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# This program calculates the Fibonacci sequence&lt;br /&gt;
a = 0&lt;br /&gt;
b = 1&lt;br /&gt;
count = 0&lt;br /&gt;
max_count = 20&lt;br /&gt;
&lt;br /&gt;
while count &amp;lt; max_count:&lt;br /&gt;
    count = count + 1&lt;br /&gt;
    print(a, end=&amp;quot; &amp;quot;)  # Notice the magic end=&amp;quot; &amp;quot; in the print function arguments  &lt;br /&gt;
                       # that keeps it from creating a new line.&lt;br /&gt;
    old_a = a    # we need to keep track of a since we change it.&lt;br /&gt;
    a = b&lt;br /&gt;
    b = old_a + b&lt;br /&gt;
print()  # gets a new (empty) line.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181&lt;br /&gt;
&lt;br /&gt;
Note that the output is on a single line because of the extra argument &amp;lt;code&amp;gt;end=&amp;quot; &amp;quot;&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; arguments.&lt;br /&gt;
&lt;br /&gt;
'''Fibonacci-method2.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Simplified and faster method to calculate the Fibonacci sequence&lt;br /&gt;
a = 0&lt;br /&gt;
b = 1&lt;br /&gt;
count = 0&lt;br /&gt;
max_count = 10&lt;br /&gt;
&lt;br /&gt;
while count &amp;lt; max_count:&lt;br /&gt;
    count = count + 1&lt;br /&gt;
    print(a, b, end=&amp;quot; &amp;quot;)  # Notice the magic end=&amp;quot; &amp;quot;&lt;br /&gt;
    a = a + b    &lt;br /&gt;
    b = a + b&lt;br /&gt;
print()  # gets a new (empty) line.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181&lt;br /&gt;
&lt;br /&gt;
'''Fibonacci-method3.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 0&lt;br /&gt;
b = 1&lt;br /&gt;
count = 0&lt;br /&gt;
maxcount = 20&lt;br /&gt;
&lt;br /&gt;
#once loop is started we stay in it&lt;br /&gt;
while count &amp;lt; maxcount:&lt;br /&gt;
    count += 1&lt;br /&gt;
    olda = a&lt;br /&gt;
    a = a + b&lt;br /&gt;
    b = olda&lt;br /&gt;
    print(olda,end=&amp;quot; &amp;quot;)&lt;br /&gt;
print()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181&lt;br /&gt;
&lt;br /&gt;
==== Enter password ====&lt;br /&gt;
'''Password.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Waits until a password has been entered.  Use Control-C to break out without&lt;br /&gt;
# the password&lt;br /&gt;
&lt;br /&gt;
#Note that this must not be the password so that the &lt;br /&gt;
# while loop runs at least once.&lt;br /&gt;
password = str()&lt;br /&gt;
&lt;br /&gt;
# note that != means not equal&lt;br /&gt;
while password != &amp;quot;unicorn&amp;quot;:&lt;br /&gt;
    password = input(&amp;quot;Password: &amp;quot;)&lt;br /&gt;
print(&amp;quot;Welcome in&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample run:&lt;br /&gt;
 Password: '''auo'''&lt;br /&gt;
 Password: '''y22'''&lt;br /&gt;
 Password: '''password'''&lt;br /&gt;
 Password: '''open sesame'''&lt;br /&gt;
 Password: '''unicorn'''&lt;br /&gt;
 Welcome in&lt;br /&gt;
&lt;br /&gt;
=== Exercises ===&lt;br /&gt;
Write a program that asks the user for a Login Name and password.  Then when they type &amp;quot;lock&amp;quot;, they need to type in their name and password to unlock the program.&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
&lt;br /&gt;
Write a program that asks the user for a Login Name and password.  Then when they type &amp;quot;lock&amp;quot;, they need to type in their name and password to unlock the program.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
name = input(&amp;quot;What is your UserName: &amp;quot;)&lt;br /&gt;
password = input(&amp;quot;What is your Password: &amp;quot;)&lt;br /&gt;
print(&amp;quot;To lock your computer type lock.&amp;quot;)&lt;br /&gt;
command = None&lt;br /&gt;
input1 = None&lt;br /&gt;
input2 = None&lt;br /&gt;
while command != &amp;quot;lock&amp;quot;:&lt;br /&gt;
    command = input(&amp;quot;What is your command: &amp;quot;)&lt;br /&gt;
while input1 != name:&lt;br /&gt;
    input1 = input(&amp;quot;What is your username: &amp;quot;)&lt;br /&gt;
while input2 != password:&lt;br /&gt;
    input2 = input(&amp;quot;What is your password: &amp;quot;)&lt;br /&gt;
print(&amp;quot;Welcome back to your system!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you would like the program to run continuously, just add a &amp;lt;code&amp;gt;while 1 == 1:&amp;lt;/code&amp;gt; loop around the whole thing.&lt;br /&gt;
You will have to indent the rest of the program when you add this at the top of the code, but don't worry, you don't have to do it manually for each line! Just highlight everything you want to indent and click on &amp;quot;Indent&amp;quot; under &amp;quot;Format&amp;quot; in the top bar of the python window.&lt;br /&gt;
&lt;br /&gt;
Another way of doing this could be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
name = input('Set name: ')&lt;br /&gt;
password = input('Set password: ')&lt;br /&gt;
while 1 == 1:&lt;br /&gt;
    nameguess=&amp;quot;&amp;quot;&lt;br /&gt;
    passwordguess=&amp;quot;&amp;quot;&lt;br /&gt;
    key=&amp;quot;&amp;quot;&lt;br /&gt;
    while (nameguess != name) or (passwordguess != password):&lt;br /&gt;
        nameguess = input('Name? ')&lt;br /&gt;
        passwordguess = input('Password? ')&lt;br /&gt;
    print(&amp;quot;Welcome,&amp;quot;, name, &amp;quot;. Type lock to lock.&amp;quot;)&lt;br /&gt;
    while key != &amp;quot;lock&amp;quot;:&lt;br /&gt;
        key = input(&amp;quot;&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; in while &amp;lt;code&amp;gt;(nameguess != name) or (passwordguess != password)&amp;lt;/code&amp;gt;, which we haven't yet introduced. You can probably figure out how it works.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Who Goes There? |next=Decisions}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Kas_%C4%8Dia_eina%3F&amp;diff=3021</id>
		<title>Python Vadovėlis/Kas čia eina?</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Kas_%C4%8Dia_eina%3F&amp;diff=3021"/>
		<updated>2021-09-13T10:30:25Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Input and Variables ===&lt;br /&gt;
Now I feel it is time for a really complicated program.  Here it is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Halt!&amp;quot;)&lt;br /&gt;
user_input = input(&amp;quot;Who goes there? &amp;quot;)&lt;br /&gt;
print(&amp;quot;You may pass,&amp;quot;,  user_input)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When '''I''' ran it, here is what '''my''' screen showed:&lt;br /&gt;
&lt;br /&gt;
 Halt!&lt;br /&gt;
 Who goes there? '''Josh'''&lt;br /&gt;
 You may pass, Josh&lt;br /&gt;
&lt;br /&gt;
''Note: After running the code by pressing F5, the python shell will only give output:''&lt;br /&gt;
&lt;br /&gt;
 Halt!&lt;br /&gt;
 Who goes there?&lt;br /&gt;
&lt;br /&gt;
''You need to enter your name in the python shell, and then press enter for the rest of the output.''&lt;br /&gt;
&lt;br /&gt;
Of course when you run the program your screen will look different&lt;br /&gt;
because of the &amp;lt;code&amp;gt;input()&amp;lt;/code&amp;gt; statement. When you ran the program&lt;br /&gt;
you probably noticed (you did run the program, right?) how you had to&lt;br /&gt;
type in your name and then press Enter. Then the program printed out&lt;br /&gt;
some more text and also your name. This is an example of ''input''.  The&lt;br /&gt;
program reaches a certain point and then waits for the user to input&lt;br /&gt;
some data that the program can use later.&lt;br /&gt;
&lt;br /&gt;
Of course, getting information from the user would be useless if we didn't have anywhere to put that information and this is where variables come in.  In the previous program &amp;lt;code&amp;gt;user_input&amp;lt;/code&amp;gt; is a ''variable''.  Variables are like a box that can store some piece of data.  Here is a program to show examples of variables:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 123.4&lt;br /&gt;
b23 = 'Spam'&lt;br /&gt;
first_name = &amp;quot;Bill&amp;quot;&lt;br /&gt;
b = 432&lt;br /&gt;
c = a + b&lt;br /&gt;
print(&amp;quot;a + b is&amp;quot;,c)&lt;br /&gt;
print(&amp;quot;first_name is&amp;quot;,first_name)&lt;br /&gt;
print(&amp;quot;Sorted Parts, After Midnight or&amp;quot;,b23)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And here is the output:&lt;br /&gt;
&lt;br /&gt;
 a + b is 555.4&lt;br /&gt;
 first_name is Bill&lt;br /&gt;
 Sorted Parts, After Midnight or Spam&lt;br /&gt;
&lt;br /&gt;
Variables store data.  The variables in the above program are &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;b23&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;first_name&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt;. The two basic types are ''strings'' and ''numbers''.  Strings are a sequence of letters, numbers and other characters. In this example &amp;lt;code&amp;gt;b23&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;first_name&amp;lt;/code&amp;gt; are variables that are storing strings. &amp;lt;code&amp;gt;Spam&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Bill&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;a + b is&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;first_name is&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;Sorted Parts, After Midnight or&amp;lt;/code&amp;gt; are the strings in this program.  The characters are surrounded by &amp;lt;code&amp;gt;&amp;quot;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;'&amp;lt;/code&amp;gt;.  The other type of variables are numbers. Remember that variables are used to store a value, they do not use quotation marks (&amp;quot; and '). If you want to use an actual ''value'', you ''must'' use quotation marks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
value1 == Pim&lt;br /&gt;
value2 == &amp;quot;Pim&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both look the same, but in the first one Python checks if the value stored in the variable &amp;lt;code&amp;gt;value1&amp;lt;/code&amp;gt; is the same as the value stored in the ''variable'' &amp;lt;code&amp;gt;Pim&amp;lt;/code&amp;gt;. In the second one, Python checks if the string (the actual letters &amp;lt;code&amp;gt;P&amp;lt;/code&amp;gt;,&amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;) are the same as in &amp;lt;code&amp;gt;value2&amp;lt;/code&amp;gt; (continue this tutorial for more explanation about strings and about the &amp;lt;code&amp;gt;==&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Assignment ===&lt;br /&gt;
&lt;br /&gt;
Okay, so we have these boxes called variables and also data that can go into the variable.  The computer will see a line like &amp;lt;code&amp;gt;first_name = &amp;quot;Bill&amp;quot;&amp;lt;/code&amp;gt; and it reads it as &amp;quot;Put the string &amp;lt;code&amp;gt;Bill&amp;lt;/code&amp;gt; into the box (or variable) &amp;lt;code&amp;gt;first_name&amp;lt;/code&amp;gt;&amp;quot;. Later on it sees the statement &amp;lt;code&amp;gt;c = a + b&amp;lt;/code&amp;gt; and it reads it as &amp;quot;put the sum of &amp;lt;code&amp;gt;a + b&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;123.4 + 432&amp;lt;/code&amp;gt; which equals &amp;lt;code&amp;gt;555.4&amp;lt;/code&amp;gt; into &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt;&amp;quot;. The right hand side of the statement (&amp;lt;code&amp;gt;a + b&amp;lt;/code&amp;gt;) is ''evaluated'' and the result is stored in the variable on the left hand side (&amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt;). This is called ''assignment'', and you should not confuse the assignment equal sign (&amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt;) with &amp;quot;equality&amp;quot; in a mathematical sense here (that's what &amp;lt;code&amp;gt;==&amp;lt;/code&amp;gt; will be used for later).&lt;br /&gt;
&lt;br /&gt;
Here is another example of variable usage:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
a = 1&lt;br /&gt;
print(a)&lt;br /&gt;
a = a + 1&lt;br /&gt;
print(a)&lt;br /&gt;
a = a * 2&lt;br /&gt;
print(a)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And of course here is the output:&lt;br /&gt;
&lt;br /&gt;
 1&lt;br /&gt;
 2&lt;br /&gt;
 4&lt;br /&gt;
&lt;br /&gt;
Even if the same variable appears on both sides of the equals sign (e.g., spam = spam), the computer still reads it as, &amp;quot;First find out the data to store and then find out where the data goes.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
One more program before I end this chapter:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
number = float(input(&amp;quot;Type in a number: &amp;quot;))&lt;br /&gt;
integer = int(input(&amp;quot;Type in an integer: &amp;quot;))&lt;br /&gt;
text = input(&amp;quot;Type in a string: &amp;quot;)&lt;br /&gt;
print(&amp;quot;number =&amp;quot;, number)&lt;br /&gt;
print(&amp;quot;number is a&amp;quot;, type(number))&lt;br /&gt;
print(&amp;quot;number * 2 =&amp;quot;, number * 2)&lt;br /&gt;
print(&amp;quot;integer =&amp;quot;, integer)&lt;br /&gt;
print(&amp;quot;integer is a&amp;quot;, type(integer))&lt;br /&gt;
print(&amp;quot;integer * 2 =&amp;quot;, integer * 2)&lt;br /&gt;
print(&amp;quot;text =&amp;quot;, text)&lt;br /&gt;
print(&amp;quot;text is a&amp;quot;, type(text))&lt;br /&gt;
print(&amp;quot;text * 2 =&amp;quot;, text * 2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output I got was:&lt;br /&gt;
&lt;br /&gt;
 Type in a number: '''12.34'''&lt;br /&gt;
 Type in an integer: '''-3'''&lt;br /&gt;
 Type in a string: '''Hello'''&lt;br /&gt;
 number = 12.34&lt;br /&gt;
 number is a &amp;lt;class 'float'&amp;gt;&lt;br /&gt;
 number * 2 = 24.68&lt;br /&gt;
 integer = -3&lt;br /&gt;
 integer is a &amp;lt;class 'int'&amp;gt;&lt;br /&gt;
 integer * 2 = -6&lt;br /&gt;
 text = Hello&lt;br /&gt;
 text is a &amp;lt;class 'str'&amp;gt;&lt;br /&gt;
 text * 2 = HelloHello&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; was created with &amp;lt;code&amp;gt;float(input())&amp;lt;/code&amp;gt; ,&amp;lt;code&amp;gt;int(input())&amp;lt;/code&amp;gt; returns an integer, a number with no decimal point, &lt;br /&gt;
while  &amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt; created with &amp;lt;code&amp;gt;input()&amp;lt;/code&amp;gt; returns a string(can be writen as &amp;lt;code&amp;gt;str(input())&amp;lt;/code&amp;gt;, too). When you want the user to type in a decimal use &amp;lt;code&amp;gt;float(input())&amp;lt;/code&amp;gt;, if you want the user to type in an integer use &amp;lt;code&amp;gt;int(input())&amp;lt;/code&amp;gt;, but if you want the user to type in a string use &amp;lt;code&amp;gt;input()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The second half of the program uses the &amp;lt;code&amp;gt;type()&amp;lt;/code&amp;gt; function which tells what kind a&lt;br /&gt;
variable is. Numbers are of type &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt;, which are&lt;br /&gt;
short for ''integer'' and ''floating point'' (mostly used for decimal numbers), respectively. Text strings are of type &amp;lt;code&amp;gt;str&amp;lt;/code&amp;gt;, short for ''string''. Integers and floats can be worked on by mathematical functions, strings cannot. Notice how when python&lt;br /&gt;
multiplies a number by an integer the expected thing happens. However&lt;br /&gt;
when a string is multiplied by an integer the result is that multiple&lt;br /&gt;
copies of the string are produced (i.e., &amp;lt;code&amp;gt;text * 2 = HelloHello&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Operations with strings do different things than &lt;br /&gt;
operations with numbers. As well, some operations only work with numbers (both integers and floating point numbers) and will give an error if a string is used. Here are some interactive mode examples&lt;br /&gt;
to show that some more.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(&amp;quot;This&amp;quot; + &amp;quot; &amp;quot; + &amp;quot;is&amp;quot; + &amp;quot; joined.&amp;quot;)&lt;br /&gt;
This is joined.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(&amp;quot;Ha, &amp;quot; * 5)&lt;br /&gt;
Ha, Ha, Ha, Ha, Ha, &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(&amp;quot;Ha, &amp;quot; * 5 + &amp;quot;ha!&amp;quot;)&lt;br /&gt;
Ha, Ha, Ha, Ha, Ha, ha!&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(3 - 1)&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(&amp;quot;3&amp;quot; - &amp;quot;1&amp;quot;)&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;
  File &amp;quot;&amp;lt;stdin&amp;gt;&amp;quot;, line 1, in &amp;lt;module&amp;gt;&lt;br /&gt;
TypeError: unsupported operand type(s) for -: 'str' and 'str'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the list of some string operations:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Operation &lt;br /&gt;
!Symbol &lt;br /&gt;
!Example&lt;br /&gt;
|-&lt;br /&gt;
|Repetition &lt;br /&gt;
|&amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; &lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;i&amp;quot; * 5 == &amp;quot;iiiii&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Concatenation &lt;br /&gt;
|&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &lt;br /&gt;
|&amp;lt;code&amp;gt;&amp;quot;Hello, &amp;quot; + &amp;quot;World!&amp;quot; == &amp;quot;Hello, World!&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
'''Rate_times.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# This program calculates rate and distance problems&lt;br /&gt;
print(&amp;quot;Input a rate and a distance&amp;quot;)&lt;br /&gt;
rate = float(input(&amp;quot;Rate: &amp;quot;))&lt;br /&gt;
distance = float(input(&amp;quot;Distance: &amp;quot;))&lt;br /&gt;
time=(distance/ rate)&lt;br /&gt;
print(&amp;quot;Time:&amp;quot;, time)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample runs:&lt;br /&gt;
&lt;br /&gt;
 Input a rate and a distance&lt;br /&gt;
 Rate: '''5'''&lt;br /&gt;
 Distance: '''10'''&lt;br /&gt;
 Time: 2.0&lt;br /&gt;
&lt;br /&gt;
 Input a rate and a distance&lt;br /&gt;
 Rate: '''3.52'''&lt;br /&gt;
 Distance: '''45.6'''&lt;br /&gt;
 Time: 12.9545454545&lt;br /&gt;
&lt;br /&gt;
'''Area.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# This program calculates the perimeter and area of a rectangle&lt;br /&gt;
print(&amp;quot;Calculate information about a rectangle&amp;quot;)&lt;br /&gt;
length = float(input(&amp;quot;Length: &amp;quot;))&lt;br /&gt;
width = float(input(&amp;quot;Width: &amp;quot;))&lt;br /&gt;
Perimeter=(2 * length + 2 * width) &lt;br /&gt;
print(&amp;quot;Area:&amp;quot;, length * width)&lt;br /&gt;
print(&amp;quot;Perimeter:&amp;quot;,Perimeter)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample runs:&lt;br /&gt;
&lt;br /&gt;
 Calculate information about a rectangle&lt;br /&gt;
 Length: '''4'''&lt;br /&gt;
 Width: '''3'''&lt;br /&gt;
 Area: 12.0&lt;br /&gt;
 Perimeter: 14.0&lt;br /&gt;
&lt;br /&gt;
 Calculate information about a rectangle&lt;br /&gt;
 Length: '''2.53'''&lt;br /&gt;
 Width: '''5.2'''&lt;br /&gt;
 Area: 13.156&lt;br /&gt;
 Perimeter: 15.46&lt;br /&gt;
&lt;br /&gt;
'''Temperature.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# This program converts Fahrenheit to Celsius&lt;br /&gt;
fahr_temp = float(input(&amp;quot;Fahrenheit temperature: &amp;quot;))&lt;br /&gt;
celc_temp = (fahr_temp - 32.0) *( 5.0 / 9.0)&lt;br /&gt;
print(&amp;quot;Celsius temperature:&amp;quot;, celc_temp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sample runs:&lt;br /&gt;
&lt;br /&gt;
 Fahrenheit temperature: '''32'''&lt;br /&gt;
 Celsius temperature: 0.0&lt;br /&gt;
&lt;br /&gt;
 Fahrenheit temperature: '''-40'''&lt;br /&gt;
 Celsius temperature: -40.0&lt;br /&gt;
&lt;br /&gt;
 Fahrenheit temperature: '''212'''&lt;br /&gt;
 Celsius temperature: 100.0&lt;br /&gt;
&lt;br /&gt;
 Fahrenheit temperature: '''98.6'''&lt;br /&gt;
 Celsius temperature: 37.0&lt;br /&gt;
&lt;br /&gt;
=== Exercises ===&lt;br /&gt;
Write a program that gets 2 string variables and 2 number variables&lt;br /&gt;
from the user, concatenates (joins them together with no spaces) and&lt;br /&gt;
displays the strings, then multiplies the two numbers on a new line.&lt;br /&gt;
&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
&lt;br /&gt;
Write a program that gets 2 string variables and 2 number variables&lt;br /&gt;
from the user, concatenates (joins them together with no spaces) and&lt;br /&gt;
displays the strings, then multiplies the two numbers on a new line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;  &lt;br /&gt;
string1 = input('String 1: ')&lt;br /&gt;
string2 = input('String 2: ')&lt;br /&gt;
float1 = float(input('Number 1: '))&lt;br /&gt;
float2 = float(input('Number 2: '))&lt;br /&gt;
print(string1 + string2)&lt;br /&gt;
print(float1 * float2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Hello, World |next=Count to 10}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Labas,_Pasauli&amp;diff=3020</id>
		<title>Python Vadovėlis/Labas, Pasauli</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Labas,_Pasauli&amp;diff=3020"/>
		<updated>2021-09-13T10:28:48Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Now for our first lesson, what is a computer program?  A computer program is a set of very detailed instructions that tell a computer what to do.   --&amp;gt;&lt;br /&gt;
=== What you should know ===&lt;br /&gt;
Once you've read and mastered this chapter, you should know how to edit programs in a text editor or IDLE, save them to the hard disk, and run them once they have been saved.&lt;br /&gt;
&lt;br /&gt;
=== Printing ===&lt;br /&gt;
&lt;br /&gt;
Programming tutorials since the beginning of time have started with a little program called &amp;quot;Hello, World!&amp;quot;&amp;lt;ref&amp;gt;[[Computer Programming/Hello world|Here]] is a great list of the famous &amp;quot;Hello, world!&amp;quot; program in many programming languages. Just so you know how simple Python can be...&amp;lt;/ref&amp;gt;  So here it is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Hello, World!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using the command line to run programs then type it in with a text editor, save it as &amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt; and run it with &amp;lt;code&amp;gt;python3 hello.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Otherwise go into IDLE, create a new window, and create the program as&lt;br /&gt;
in section [[Non-Programmer's Tutorial for Python 3/Intro#Creating_and_Running_Programs|Creating and Running Programs]].&lt;br /&gt;
&lt;br /&gt;
When this program is run here's what it prints:&lt;br /&gt;
&lt;br /&gt;
 Hello, World!&lt;br /&gt;
&lt;br /&gt;
Now I'm not going to tell you this every time, but when I show you a&lt;br /&gt;
program I recommend that you type it in and run it.  I learn better&lt;br /&gt;
when I type it in and you probably do too.&lt;br /&gt;
&lt;br /&gt;
Now here is a more complicated program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Jack and Jill went up a hill&amp;quot;)&lt;br /&gt;
print(&amp;quot;to fetch a pail of water;&amp;quot;)&lt;br /&gt;
print(&amp;quot;Jack fell down, and broke his crown,&amp;quot;)&lt;br /&gt;
print(&amp;quot;and Jill came tumbling after.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you run this program it prints out:&lt;br /&gt;
&lt;br /&gt;
 Jack and Jill went up a hill&lt;br /&gt;
 to fetch a pail of water;&lt;br /&gt;
 Jack fell down, and broke his crown,&lt;br /&gt;
 and Jill came tumbling after.&lt;br /&gt;
&lt;br /&gt;
When the computer runs this program it first sees the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Jack and Jill went up a hill&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
so the computer prints:&lt;br /&gt;
&lt;br /&gt;
 Jack and Jill went up a hill&lt;br /&gt;
&lt;br /&gt;
Then the computer goes down to the next line and sees:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;to fetch a pail of water;&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So the computer prints to the screen:&lt;br /&gt;
&lt;br /&gt;
 to fetch a pail of water;&lt;br /&gt;
&lt;br /&gt;
The computer keeps looking at each line, follows the command and then goes on to the next line.  The computer keeps running commands until it reaches the end of the program.&lt;br /&gt;
&lt;br /&gt;
==== Terminology ====&lt;br /&gt;
Now is probably a good time to give you a bit of an explanation of what is happening - and a little bit of programming terminology.&lt;br /&gt;
&lt;br /&gt;
What we were doing above was using a ''function'' called &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt;.  The function's name - &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; - is followed by parentheses containing zero or more ''arguments''.  So in this example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Hello, World!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
there is one ''argument'', which is &amp;lt;code&amp;gt;&amp;quot;Hello, World!&amp;quot;&amp;lt;/code&amp;gt;.  Note that this argument is a group of characters enclosed in double quotes (&amp;quot;&amp;quot;).  This is commonly referred to as a ''string of characters'', or ''string'', for short.  Another example of a string is &amp;lt;code&amp;gt;&amp;quot;Jack and Jill went up a hill&amp;quot;&amp;lt;/code&amp;gt;.  The combination of a function and parentheses with the arguments is a ''function call''.&lt;br /&gt;
&lt;br /&gt;
A function and its arguments are one type of ''statement'' that python has, so&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Hello, World!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is an example of a statement.  Basically, you can think of a statement as a single line in a program.  &lt;br /&gt;
&lt;br /&gt;
That's probably more than enough terminology for now.&lt;br /&gt;
&lt;br /&gt;
====\n in Printing====&lt;br /&gt;
&amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt;, or newline in printing makes the strings after the \n in a new line, it is also an escape character, here is an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Hello, World!\nWhat should I do?&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the output:&lt;br /&gt;
&lt;br /&gt;
 Hello, World!&lt;br /&gt;
 What should I do?&lt;br /&gt;
&lt;br /&gt;
It can be used to put a bunch of strings that are supposed to be on different lines into 1 print statement&lt;br /&gt;
instead of making multiple print statements&lt;br /&gt;
&lt;br /&gt;
The print statement also sort of uses &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt; even if you do not use it for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Hello, World!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
is actually&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Hello, World!\n&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Well, there is a difference if you do it manually, but python actually adds a newline &amp;quot;behind the scenes&amp;quot; at the end of the string&lt;br /&gt;
&lt;br /&gt;
=== Expressions ===&lt;br /&gt;
Here is another program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;2 + 2 is&amp;quot;, 2 + 2)&lt;br /&gt;
print(&amp;quot;3 * 4 is&amp;quot;, 3 * 4)&lt;br /&gt;
print(&amp;quot;100 - 1 is&amp;quot;, 100 - 1)&lt;br /&gt;
print(&amp;quot;(33 + 2) / 5 + 11.5 is&amp;quot;, (33 + 2) / 5 + 11.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And here is the ''output'' when the program is run:&lt;br /&gt;
&lt;br /&gt;
 2 + 2 is 4&lt;br /&gt;
 3 * 4 is 12&lt;br /&gt;
 100 - 1 is 99&lt;br /&gt;
 (33 + 2) / 5 + 11.5 is 18.5&lt;br /&gt;
&lt;br /&gt;
As you can see, Python can turn your thousand-dollar computer into a five-dollar calculator.&lt;br /&gt;
&lt;br /&gt;
==== Arithmetic expressions ====&lt;br /&gt;
&lt;br /&gt;
In this example, the print function is followed by two arguments, with each of the arguments separated by a comma.  So with the first line of the program&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;2 + 2 is&amp;quot;, 2 + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first argument is the string &amp;lt;code&amp;gt;&amp;quot;2 + 2 is&amp;quot;&amp;lt;/code&amp;gt; and the second argument is the ''arithmetic expression'' &amp;lt;code&amp;gt;2 + 2&amp;lt;/code&amp;gt;, which is one kind of ''expression''.&lt;br /&gt;
&lt;br /&gt;
What is important to note is that a string is printed as is (without the enclosing double quotes), but an ''expression'' is ''evaluated'', or converted to its actual value.&lt;br /&gt;
&lt;br /&gt;
Python has seven basic operations for numbers: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Operation &lt;br /&gt;
! Symbol &lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
|Power (exponentiation)&lt;br /&gt;
| &amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;5 ** 2 == 25&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Multiplication &lt;br /&gt;
| &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; &lt;br /&gt;
|&amp;lt;code&amp;gt;2 * 3 == 6&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Division &lt;br /&gt;
| &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;14 / 3 == 4.666666666666667&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Integer Division&lt;br /&gt;
| &amp;lt;code&amp;gt;//&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;14 // 3 == 4&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Remainder (modulo)&lt;br /&gt;
| &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;14 % 3 == 2&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Addition &lt;br /&gt;
| &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;1 + 2 == 3&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|Subtraction &lt;br /&gt;
| &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; &lt;br /&gt;
| &amp;lt;code&amp;gt;4 - 3 == 1&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notice that there are two ways to do division, one that returns the repeating decimal, and the other that can get the remainder and the whole number.  &lt;br /&gt;
The order of operations is the same as in math:&lt;br /&gt;
* parentheses &amp;lt;code&amp;gt;()&amp;lt;/code&amp;gt;&lt;br /&gt;
* exponents &amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt;&lt;br /&gt;
* multiplication &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;, division &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt;, integer division &amp;lt;code&amp;gt;//&amp;lt;/code&amp;gt;, and remainder &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; &lt;br /&gt;
* addition &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; and subtraction &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;&lt;br /&gt;
So use parentheses to structure your formulas when needed.&lt;br /&gt;
&lt;br /&gt;
=== Commenting in Python ===&lt;br /&gt;
&lt;br /&gt;
Often in programming, you are doing something complicated and may not in the future remember what you did.  When this happens the program should probably be commented.  A ''comment'' is a note to you and other programmers explaining what is happening.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Not quite PI, but a credible simulation&lt;br /&gt;
print(22 / 7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which outputs&lt;br /&gt;
&lt;br /&gt;
 3.14285714286&lt;br /&gt;
&lt;br /&gt;
Notice that the comment starts with a hash: &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;. Comments are used to communicate with others who read the program and your future self to make clear what is complicated.&lt;br /&gt;
&lt;br /&gt;
Note that any text can follow comment and that when the program is run, the text after the &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; through to the end of that line is ignored. The &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; does not have to be at the beginning of a new line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Output PI on the screen&lt;br /&gt;
print(22 / 7) # Well, just a good approximation&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
Each chapter (eventually) will contain examples of the programming features introduced in the chapter.  You should at least look over them and see if you understand them.  If you don't, you may want to type them in and see what happens.  Mess around with them, change them and see what happens.  &lt;br /&gt;
&lt;br /&gt;
'''Denmark.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Something's rotten in the state of Denmark.&amp;quot;)&lt;br /&gt;
print(&amp;quot;                -- Shakespeare&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Something's rotten in the state of Denmark.&lt;br /&gt;
                 -- Shakespeare&lt;br /&gt;
&lt;br /&gt;
'''School.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# This is not quite true outside of USA&lt;br /&gt;
# and is based on my dim memories of my younger years&lt;br /&gt;
print(&amp;quot;Firstish Grade&amp;quot;)&lt;br /&gt;
print(&amp;quot;1 + 1 =&amp;quot;, 1 + 1)&lt;br /&gt;
print(&amp;quot;2 + 4 =&amp;quot;, 2 + 4)&lt;br /&gt;
print(&amp;quot;5 - 2 =&amp;quot;, 5 - 2)&lt;br /&gt;
print()&lt;br /&gt;
print(&amp;quot;Thirdish Grade&amp;quot;)&lt;br /&gt;
print(&amp;quot;243 - 23 =&amp;quot;, 243 - 23)&lt;br /&gt;
print(&amp;quot;12 * 4 =&amp;quot;, 12 * 4)&lt;br /&gt;
print(&amp;quot;12 / 3 =&amp;quot;, 12 / 3)&lt;br /&gt;
print(&amp;quot;13 / 3 =&amp;quot;, 13 // 3, &amp;quot;R&amp;quot;, 13 % 3)&lt;br /&gt;
print()&lt;br /&gt;
print(&amp;quot;Junior High&amp;quot;)&lt;br /&gt;
print(&amp;quot;123.56 - 62.12 =&amp;quot;, 123.56 - 62.12)&lt;br /&gt;
print(&amp;quot;(4 + 3) * 2 =&amp;quot;, (4 + 3) * 2)&lt;br /&gt;
print(&amp;quot;4 + 3 * 2 =&amp;quot;, 4 + 3 * 2)&lt;br /&gt;
print(&amp;quot;3 ** 2 =&amp;quot;, 3 ** 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Firstish Grade&lt;br /&gt;
 1 + 1 = 2&lt;br /&gt;
 2 + 4 = 6&lt;br /&gt;
 5 - 2 = 3&lt;br /&gt;
 &lt;br /&gt;
 Thirdish Grade&lt;br /&gt;
 243 - 23 = 220&lt;br /&gt;
 12 * 4 = 48&lt;br /&gt;
 12 / 3 = 4&lt;br /&gt;
 13 / 3 = 4 R 1&lt;br /&gt;
 &lt;br /&gt;
 Junior High&lt;br /&gt;
 123.56 - 62.12 = 61.44&lt;br /&gt;
 (4 + 3) * 2 = 14&lt;br /&gt;
 4 + 3 * 2 = 10&lt;br /&gt;
 3 ** 2 = 9&lt;br /&gt;
&lt;br /&gt;
=== Exercises ===&lt;br /&gt;
&lt;br /&gt;
# Write a program that prints your full name and your birthday as separate strings.&lt;br /&gt;
# Write a program that shows the use of all 7 [[#Arithmetic_expressions|arithmetic operations]].&lt;br /&gt;
&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
&lt;br /&gt;
1. Write a program that prints your full name and your birthday as separate strings.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Ada Lovelace&amp;quot;, &amp;quot;born on&amp;quot;, &amp;quot;November 27, 1852&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Albert Einstein&amp;quot;, &amp;quot;born on&amp;quot;, &amp;quot;14 March 1879&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print((&amp;quot;John Smith&amp;quot;), (&amp;quot;born on&amp;quot;), (&amp;quot;14 March 1879&amp;quot;))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Solution|title=Solution|text=&lt;br /&gt;
2. Write a program that shows the use of all 7 [[#Arithmetic_expressions|arithmetic operations]].&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;5**5 = &amp;quot;, 5**5)&lt;br /&gt;
print(&amp;quot;6*7 = &amp;quot;, 6*7)&lt;br /&gt;
print(&amp;quot;56/8 = &amp;quot;, 56/8)&lt;br /&gt;
print(&amp;quot;14//6 = &amp;quot;, 14//6)&lt;br /&gt;
print(&amp;quot;14%6 = &amp;quot;, 14%6)&lt;br /&gt;
print(&amp;quot;5+6 = &amp;quot;, 5+6)&lt;br /&gt;
print(&amp;quot;9-0 = &amp;quot;, 9-0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Footnotes ====&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Intro |next=Who Goes There?}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AE%C5%BEanga&amp;diff=3019</id>
		<title>Python Vadovėlis/Įžanga</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AE%C5%BEanga&amp;diff=3019"/>
		<updated>2021-09-13T10:28:20Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All example Python source code in this tutorial is granted to the public domain.  Therefore you may modify it and relicense it under any license you please. Since you are expected to learn programming, the Creative Commons Attribution-ShareAlike license would require you to keep all programs that are derived from the source code in this tutorial under that license. Since the Python source code is granted to the public domain, that requirement is waived.&lt;br /&gt;
&lt;br /&gt;
This tutorial is more or less a conversion of [[Non-Programmer's Tutorial for Python 2.6]].  Older versions and some versions in Korean, Spanish, Italian and Greek are available from [http://jjc.freeshell.org/easytut/ http://jjc.freeshell.org/easytut/]&lt;br /&gt;
&lt;br /&gt;
The ''Non-Programmers' Tutorial For Python 3'' is a tutorial designed to be an introduction to the Python programming language.  This guide is for someone with no programming experience.&lt;br /&gt;
&lt;br /&gt;
If you have programmed in other languages I recommend using [https://docs.python.org/3/tutorial/index.html Python Tutorial for Programmers] written by Guido van Rossum.  &lt;br /&gt;
&lt;br /&gt;
If you have any questions or comments please use the discussion pages or see [[Non-Programmer's Tutorial for Python 3/Authors|Authors]] page for author contact information.  I welcome questions and comments about this tutorial.  I will try to answer any questions you have as best I can.  &lt;br /&gt;
&lt;br /&gt;
Thanks go to James A. Brown for writing most of the Windows install info.  Thanks also to Elizabeth Cogliati for complaining enough :) about the original tutorial (that is almost unusable for a non-programmer), for proofreading, and for many ideas and comments on it.  Thanks to Joe Oppegaard for writing almost all the exercises.  Thanks to everyone I have missed.&lt;br /&gt;
&lt;br /&gt;
=== Other resources ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.python.org Python Home Page]&lt;br /&gt;
* [https://docs.python.org/3/ Python 3 Documentation]&lt;br /&gt;
* [http://www.swaroopch.com/notes/python A Byte of Python by Swaroop C H]&lt;br /&gt;
* [http://python3porting.com/ Porting to Python 3: An in-depth guide]&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Authors |next=Intro}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Print_version&amp;diff=3018</id>
		<title>Šablonas:Print version</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Print_version&amp;diff=3018"/>
		<updated>2021-09-13T10:27:28Z</updated>

		<summary type="html">&lt;p&gt;Mantas: Atmestas Mantas (Aptarimas) pakeitimas; sugrąžinta mantas&amp;gt;Pi zero versija&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{mbox-side|type=growth|image=Printer.svg|text=A '''''[[:{{existlist|{{{1}}}|/Print version|/Printable version|../Print version|../Printable version|{{FULLPAGENAME}}}}|printable version]]''''' of {{{3|{{ROOTPAGENAME}}}}} is available. &amp;lt;small&amp;gt;{{{2|}}} ([{{fullurl:{{existlist|{{{1}}}|/Print version|/Printable version|../Print version|../Printable version|{{FULLPAGENAME}}}}|action=edit}} edit it])&amp;lt;/small&amp;gt;}}&amp;lt;includeonly&amp;gt;{{#ifeq:{{{example|no}}}|no|&lt;br /&gt;
{{#ifeq:{{NAMESPACE}}||[[Category:Books with print version|{{SUBPAGENAME}}]]}}}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Print_version&amp;diff=3017</id>
		<title>Šablonas:Print version</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Print_version&amp;diff=3017"/>
		<updated>2021-09-13T10:26:40Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{mbox-side|type=growth|text=A '''''[[:{{existlist|{{{1}}}|/Print version|/Printable version|../Print version|../Printable version|{{FULLPAGENAME}}}}|printable version]]''''' of {{{3|{{ROOTPAGENAME}}}}} is available. &amp;lt;small&amp;gt;{{{2|}}} ([{{fullurl:{{existlist|{{{1}}}|/Print version|/Printable version|../Print version|../Printable version|{{FULLPAGENAME}}}}|action=edit}} edit it])&amp;lt;/small&amp;gt;}}&amp;lt;includeonly&amp;gt;{{#ifeq:{{{example|no}}}|no|&lt;br /&gt;
{{#ifeq:{{NAMESPACE}}||[[Category:Books with print version|{{SUBPAGENAME}}]]}}}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:PDF_version&amp;diff=3016</id>
		<title>Šablonas:PDF version</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:PDF_version&amp;diff=3016"/>
		<updated>2021-09-13T10:24:39Z</updated>

		<summary type="html">&lt;p&gt;Mantas: Atmestas Mantas (Aptarimas) pakeitimas; sugrąžinta mantas&amp;gt;Koavf versija&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{mbox-side|type=growth|image=Gnome-mime-application-pdf.svg|msg=A '''''{{#ifexist:Media:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}.pdf&lt;br /&gt;
|[[Media:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}.pdf|PDF version]]{{#ifeq:{{{example|no}}}|no|{{#ifeq:{{NAMESPACE}}||[[Category:Books with PDF version]]}}}}&lt;br /&gt;
|PDF version{{#ifeq:{{{example|no}}}|no|{{#ifeq:{{NAMESPACE}}||[[Category:Books with PDF version required]]}}}}&lt;br /&gt;
}}'''''{{#if:{{{3|}}}|&amp;amp;nbsp;of {{{3}}}}} is available. &amp;lt;small&amp;gt;{{{2|}}} ({{#ifexist:Media:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}.pdf|[[:File:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}.pdf|info]]|[[Help:Print versions#PDF versions|info]]}})  {{#ifexist:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}/LaTeX | ([[{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}/LaTeX|source]]) }}&amp;lt;/small&amp;gt;}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:PDF_version&amp;diff=3015</id>
		<title>Šablonas:PDF version</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:PDF_version&amp;diff=3015"/>
		<updated>2021-09-13T10:23:44Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{mbox-side|type=growth|msg=A '''''{{#ifexist:Media:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}.pdf&lt;br /&gt;
|[[Media:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}.pdf|PDF version]]{{#ifeq:{{{example|no}}}|no|{{#ifeq:{{NAMESPACE}}||[[Category:Books with PDF version]]}}}}&lt;br /&gt;
|PDF version{{#ifeq:{{{example|no}}}|no|{{#ifeq:{{NAMESPACE}}||[[Category:Books with PDF version required]]}}}}&lt;br /&gt;
}}'''''{{#if:{{{3|}}}|&amp;amp;nbsp;of {{{3}}}}} is available. &amp;lt;small&amp;gt;{{{2|}}} ({{#ifexist:Media:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}.pdf|[[:File:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}.pdf|info]]|[[Help:Print versions#PDF versions|info]]}})  {{#ifexist:{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}/LaTeX | ([[{{{1|{{{3|{{#ifeq:{{NAMESPACE}}|Wikijunior|Wikijunior-|}}{{BASEPAGENAME}}}}}}}}/LaTeX|source]]) }}&amp;lt;/small&amp;gt;}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis&amp;diff=3014</id>
		<title>Python Vadovėlis</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis&amp;diff=3014"/>
		<updated>2021-09-13T10:11:41Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tai - standartinės Python programavimo kalbos vadovėlis, išverstas iš [https://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3 Non programmer's Tutorial for Python 3].&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis yra atvirojo kodo, [https://www.gnu.org/licenses/gpl-3.0.html GPL v3] licencija.&lt;br /&gt;
&lt;br /&gt;
==Contents==&lt;br /&gt;
{{print version}}&lt;br /&gt;
{{PDF version}}&lt;br /&gt;
;[[Vadovėlis/Authors]] &lt;br /&gt;
: Contributors to this book&lt;br /&gt;
;[[Vadovėlis/Front matter]]&lt;br /&gt;
: Initial remarks&lt;br /&gt;
;[[Vadovėlis/Intro]]&lt;br /&gt;
: Installing and using Python&amp;amp;nbsp;&amp;amp;ndash; where to get help&lt;br /&gt;
;[[Vadovėlis/Hello, World]]&lt;br /&gt;
: The famous first program&amp;amp;nbsp;&amp;amp;ndash; screen output&amp;amp;nbsp;&amp;amp;ndash; variables&amp;amp;nbsp;&amp;amp;ndash; numbers and calculations&lt;br /&gt;
;[[Vadovėlis/Who Goes There?]]&lt;br /&gt;
: Interactive input&amp;amp;nbsp;&amp;amp;ndash; strings&lt;br /&gt;
;[[Vadovėlis/Count to 10]]&lt;br /&gt;
: &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loops&lt;br /&gt;
;[[Vadovėlis/Decisions]]&lt;br /&gt;
: &amp;lt;tt&amp;gt;if&amp;lt;/tt&amp;gt; statements&lt;br /&gt;
;[[Vadovėlis/Debugging]]&lt;br /&gt;
: Finding out what goes wrong&lt;br /&gt;
;[[Vadovėlis/Defining Functions]]&lt;br /&gt;
: Structuring programs with the use of functions&lt;br /&gt;
;[[Vadovėlis/Advanced Functions Example]]&lt;br /&gt;
: (Almost) mind-blowing example of how programmers can think&lt;br /&gt;
;[[Vadovėlis/Lists]]&lt;br /&gt;
: Variables containing more than one value&lt;br /&gt;
;[[Vadovėlis/For Loops]]&lt;br /&gt;
: A second kind of loop&lt;br /&gt;
;[[Vadovėlis/Boolean Expressions]]&lt;br /&gt;
: Computer logic&amp;amp;nbsp;&amp;amp;ndash; &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;&amp;amp;nbsp;&amp;amp;ndash; &amp;lt;tt&amp;gt;and&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;or&amp;lt;/tt&amp;gt;&amp;amp;nbsp;&amp;amp;ndash; &amp;lt;tt&amp;gt;not&amp;lt;/tt&amp;gt;&lt;br /&gt;
;[[Vadovėlis/Dictionaries]]&lt;br /&gt;
: Variables containing key/value pairs&lt;br /&gt;
;[[Vadovėlis/Using Modules]]&lt;br /&gt;
: Extensions to the standard set of functionality&lt;br /&gt;
;[[Vadovėlis/More on Lists]]&lt;br /&gt;
: Using elements or parts of lists&lt;br /&gt;
;[[Vadovėlis/Revenge of the Strings]]&lt;br /&gt;
: More advanced text manipulations&lt;br /&gt;
;[[Vadovėlis/File IO]]&lt;br /&gt;
: Reading from files and writing to files&lt;br /&gt;
;[[Vadovėlis/Dealing with the imperfect]]&lt;br /&gt;
: How to handle errors&lt;br /&gt;
;[[Vadovėlis/Recursion]]&lt;br /&gt;
: Recursive Functions&lt;br /&gt;
;[[Vadovėlis/Intro to Object Oriented Programming in Python 3]]&lt;br /&gt;
: Basics of OOP (Object Oriented Programming)&lt;br /&gt;
;[[Vadovėlis/Intro to Imported Libraries and other Functions]]&lt;br /&gt;
: Basic functions from various libraries.&lt;br /&gt;
;[[Vadovėlis/The End]]&lt;br /&gt;
: How to go further&lt;br /&gt;
;[[Vadovėlis/FAQ]]&lt;br /&gt;
: Some frequently asked questions&lt;br /&gt;
&lt;br /&gt;
{{Alphabetical|N}}&lt;br /&gt;
{{status|100%}}&lt;br /&gt;
__NOTOC__ __NOEDITSECTION__&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3013</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3013"/>
		<updated>2021-09-13T10:07:27Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;'''[[{{#titleparts:{{BASEPAGENAME}}|-1}} | Turinys]] '''&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3012</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3012"/>
		<updated>2021-09-13T10:07:06Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;[[{{#titleparts:{{BASEPAGENAME}}|-1}} | Turinys]]  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3011</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3011"/>
		<updated>2021-09-13T10:06:51Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;[[{{#titleparts:{{BASEPAGENAME}}|-1}} Turinys]]  &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3010</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3010"/>
		<updated>2021-09-13T10:06:16Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;[[{{#titleparts:{{BASEPAGENAME}}|-1}}]] / '''{{#titleparts:{{SUBPAGENAME}}|2}}'''   &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3009</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3009"/>
		<updated>2021-09-13T10:04:44Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;[[{{#titleparts:{{BASEPAGENAME}}|-1}}]] / '''{{#titleparts:{{SUBPAGENAME}}|0}}'''   &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3008</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3008"/>
		<updated>2021-09-13T10:04:16Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;[[{{#titleparts:{{BASEPAGENAME}}|-1}}]] / '''{{#titleparts:{{SUBPAGENAME}}|1}}'''   &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3007</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3007"/>
		<updated>2021-09-13T10:02:41Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;'''{{SUBPAGENAME}}'''  [[{{#titleparts:{{BASEPAGENAME}}|-1}}]] up : {{{up}}} &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3006</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3006"/>
		<updated>2021-09-13T10:00:30Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;'''{{SUBPAGENAME}}'''  Mantas {{#titleparts:{{BASEPAGENAME}}|0}} ir {{#titleparts:{{BASEPAGENAME}}|-1}} &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3005</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3005"/>
		<updated>2021-09-13T09:59:19Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;'''{{SUBPAGENAME}}'''  Mantas {{#titleparts:{{BASEPAGENAME}}|0}} ir {{PAGENAME}}|0}} &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3004</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3004"/>
		<updated>2021-09-13T09:58:33Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;'''{{SUBPAGENAME}}'''  Mantas {{#titleparts:{{FULLPAGENAME}}|0}} &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3003</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=3003"/>
		<updated>2021-09-13T09:58:04Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;'''{{SUBPAGENAME}}'''  Mantas {{BASEPAGENAME}} &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3002</id>
		<title>Python Vadovėlis/Įvadas</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3002"/>
		<updated>2021-09-13T09:56:52Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Front matter |next=Hello, World}}&lt;br /&gt;
&lt;br /&gt;
=== First things first ===&lt;br /&gt;
So, you've never programmed before. As we go through this tutorial, I&lt;br /&gt;
will attempt to teach you how to program. There really is only one&lt;br /&gt;
way to learn to program. '''You''' must read ''code'' and write ''code'' (as computer programs are often called).&lt;br /&gt;
I'm going to show you lots of code. You should type in code that I&lt;br /&gt;
show you to see what happens. Play around with it and make changes.&lt;br /&gt;
The worst that can happen is that it won't work. When I type in code&lt;br /&gt;
it will be formatted like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python is easy to learn&lt;br /&gt;
print(&amp;quot;Hello, World!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's so it is easy to distinguish from the other text. If you're reading this on the Web, you'll notice the code is in color -- that's just to make it stand out, and to make the different parts of the code stand out from each other. The code you enter will probably not be colored, or the colors may be different, but it won't affect the code as long as you enter it the same way as it's printed here.&lt;br /&gt;
&lt;br /&gt;
If the computer prints something out it will be formatted like this:&lt;br /&gt;
&lt;br /&gt;
 Hello, World!&lt;br /&gt;
&lt;br /&gt;
(Note that printed text goes to your screen, and does not involve paper. Before computers had screens, the output of computer programs would be printed on paper.)&lt;br /&gt;
&lt;br /&gt;
Note that this is a Python 3 tutorial, which means that most of the examples will not work in Python 2.7 and before. As well, all but a small number of the extra Python 2.7 libraries (third-party libraries) have been converted to Python 3. Most likely you will want to learn Python 3, but if you are learning Python for a specific package or set of modules that are only written in Python 2.7, you may want to consider learning from the [[Non-Programmer's Tutorial for Python 2.6]]. However, the differences between Python 2 and 3 are not particularly large, so if you learn one, you should be able to read programs written for the other without much difficulty. &lt;br /&gt;
&lt;br /&gt;
There will often be a mixture of the text you type (which is shown in '''bold''') and the text the program prints to the screen, which would look like this:&lt;br /&gt;
&lt;br /&gt;
 Halt!&lt;br /&gt;
 Who Goes there? '''Josh'''&lt;br /&gt;
 You may pass, Josh&lt;br /&gt;
&lt;br /&gt;
(Some of the tutorial has not been converted to this format. Since this is a wiki, you can convert it when you find it.)&lt;br /&gt;
&lt;br /&gt;
I will also introduce you to the terminology of programming - for example, that programming is often referred to as ''coding'' or ''hacking''. This will not only help you understand what programmers are talking about, but also help the learning process.&lt;br /&gt;
&lt;br /&gt;
Now, on to more important things. In order to program in Python you need the Python 3 software. If you don't already have the Python software go to [http://www.python.org/download/ www.python.org/download] and get the proper version for your platform. Download it, read the instructions and get it installed.&lt;br /&gt;
&lt;br /&gt;
=== Installing Python ===&lt;br /&gt;
For Python programming you need a working Python installation and a text editor. Python comes with its own editor, ''IDLE'', which is quite nice and totally sufficient for the beginning. As you get more into programming, you will probably switch to some other editor like &amp;lt;tt&amp;gt;nano&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;emacs&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;vi&amp;lt;/tt&amp;gt; or another.&lt;br /&gt;
&lt;br /&gt;
The Python download page is http://www.python.org/download. The most recent version is Python 3.9.6 (as of July 2021); '''Python 2.7 and older versions will not work with this tutorial.''' There are various different installation files for different computer platforms available on the download site. Here are some specific instructions for the most common operating systems:&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, and Unix users ====&lt;br /&gt;
You are probably lucky and Python is already installed on your machine. To test it type &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt; on a command line. If you see something like what is shown [[#Interactive Mode|in the following section]], you are set.&lt;br /&gt;
&lt;br /&gt;
IDLE may need to be installed separately, from its own package such as &amp;lt;tt&amp;gt;idle3&amp;lt;/tt&amp;gt; or as part of &amp;lt;tt&amp;gt;python-tools&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If you have to install Python, first try to use the operating system's package manager or go to the repository where your packages are available and get Python 3. Python 3.0 was released in December 2008; all distributions should have Python 3 available, so you may not need to compile it from scratch. Ubuntu and Fedora do have Python 3 binary packages available, but they are not yet the default, so they need to be installed specially.&amp;lt;!-- Is this realistic for people who don't know how to program???  --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Roughly, here are the steps to compile Python from source code in Unix (If these totally don't make sense, you may want to read another introduction to *nix, such as [http://tldp.org/LDP/intro-linux/html/index.html Introduction to Linux]):&lt;br /&gt;
* Download the .tgz file (use your Web browser to get the gzipped tar file from https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz)&lt;br /&gt;
* Uncompress the tar file (put in the correct path to where you downloaded it):&lt;br /&gt;
 $ tar -xvzf ~/Download/Python-3.7.4.tgz&lt;br /&gt;
 ''... list of files as they are uncompressed ''&lt;br /&gt;
* Change to the directory and tell the computer to compile and install the program&lt;br /&gt;
 $ cd Python-3.7/&lt;br /&gt;
 $ ./configure --prefix=$HOME/python3_install&lt;br /&gt;
 '' ... lots of output.  Watch for error messages here ... ''&lt;br /&gt;
 $ make&lt;br /&gt;
 '' ... even more output.  Hopefully no error messages ... ''&lt;br /&gt;
 $ make install&lt;br /&gt;
* Add Python 3 to your path. You can test it first by specifying the full path. You should add $HOME/python3_install/bin to your PATH bash variable.&lt;br /&gt;
 $ ~/python3_install/bin/python3&lt;br /&gt;
 Python 3.7.4 (... size and date information ...)&lt;br /&gt;
 [GCC 9.1.0] on linux&lt;br /&gt;
 Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
The above commands will install Python 3 to your home directory, which is probably what you want, but if you skip the &amp;lt;tt&amp;gt;--prefix=$HOME/python3_install&amp;lt;/tt&amp;gt;, it will install it to &amp;lt;tt&amp;gt;/usr/local&amp;lt;/tt&amp;gt;. If you want to use the IDLE graphical code editor, you need to make sure that the &amp;lt;tt&amp;gt;tk&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tcl&amp;lt;/tt&amp;gt; libraries, together with their development files, are installed on the system.  You will get a warning during the &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt; phase if these are not available.&lt;br /&gt;
&lt;br /&gt;
==== Mac users ====&lt;br /&gt;
Starting from Mac OS X Tiger (10.4), versions of Python 2 shipped with the operating system by default, but you will need to also install Python 3 unless Mac OS starts including Python 3 (check the version by starting &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt; in a command line terminal). Also IDLE (the Python editor) might be missing in the standard installation. If you want to (re-)install Python, get the Mac OS installer from the [https://www.python.org/downloads/release/python-380/ Python download site].&lt;br /&gt;
&lt;br /&gt;
==== Windows users ====&lt;br /&gt;
Download the appropriate Windows installer (the [https://www.python.org/ftp/python/3.4.3/python-3.4.3.msi x86 MSI installer], if you do not have a 64-bit AMD or Intel chip).  Start the installer by double-clicking it and follow the prompts.&lt;br /&gt;
&lt;br /&gt;
See https://docs.python.org/3/using/windows.html#installing-python for more information.&lt;br /&gt;
&lt;br /&gt;
===== Configuring your PATH environment variable =====&lt;br /&gt;
&lt;br /&gt;
The PATH environment variable is a list of folders, separated by semicolons, in which Windows will look for a program whenever you try to execute one by typing its name at a Command Prompt. You can see the current value of your PATH by typing this command at a Command Prompt:&lt;br /&gt;
&lt;br /&gt;
 echo %PATH%&lt;br /&gt;
&lt;br /&gt;
The easiest way to permanently change environment variables is to bring up the built-in environment variable editor in Windows.  How you get to this editor is slightly different on different versions of Windows.&lt;br /&gt;
&lt;br /&gt;
'''On Windows 8''' or '''Windows 10''': Press the Windows key and type ''Control Panel'' to locate the Windows Control Panel.  Once you've opened the Control Panel, select View by: Large Icons, then click on ''System''.  In the window that pops up, click the ''Advanced System Settings'' link, then click the ''Environment Variables...'' button.&lt;br /&gt;
&lt;br /&gt;
'''On Windows 7''' or '''Vista''': Click the Start button in the lower-left corner of the screen, move your mouse over ''Computer'', right-click, and select ''Properties'' from the pop-up menu. Click the ''Advanced System Settings'' link, then click the ''Environment Variables...'' button.&lt;br /&gt;
&lt;br /&gt;
Once you've brought up the environment variable editor, you'll do the same thing regardless of which version of Windows you're running. Under ''System Variables'' in the bottom half of the editor, find a variable called &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. If there is is one, select it and click ''Edit...''. Assuming your Python root is &amp;lt;tt&amp;gt;C:\Python37&amp;lt;/tt&amp;gt;, add these two folders to your path (and make sure you get the semicolons right; there should be a semicolon between each folder in the list):&lt;br /&gt;
&lt;br /&gt;
 C:\Python37&lt;br /&gt;
 C:\Python37\Scripts&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If you want to double-click and start your Python programs from a Windows folder and not have the console window disappear, you can add the following code to the bottom of each script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#stops console from exiting&lt;br /&gt;
end_prog = &amp;quot;&amp;quot;&lt;br /&gt;
while end_prog != &amp;quot;q&amp;quot;:&lt;br /&gt;
        end_prog = input(&amp;quot;type q to quit&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Interactive Mode ===&lt;br /&gt;
Go into IDLE (also called the Python GUI). You should see a window that has some text like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Python 3.0 (r30:67503, Dec 29 2008, 21:31:07) &lt;br /&gt;
[GCC 4.3.2 20081105 (Red Hat 4.3.2-7)] on linux2&lt;br /&gt;
Type &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license()&amp;quot; for more information.&lt;br /&gt;
&lt;br /&gt;
    ****************************************************************&lt;br /&gt;
    Personal firewall software may warn about the connection IDLE&lt;br /&gt;
    makes to its subprocess using this computer's internal loopback&lt;br /&gt;
    interface.  This connection is not visible on any external&lt;br /&gt;
    interface and no data is sent to or received from the Internet.&lt;br /&gt;
    ****************************************************************&lt;br /&gt;
    &lt;br /&gt;
IDLE 3.0      &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; is Python's way of telling you that you are in&lt;br /&gt;
interactive mode. In interactive mode what you type is immediately&lt;br /&gt;
run. Try typing &amp;lt;code&amp;gt;1+1&amp;lt;/code&amp;gt; in. Python will respond with &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;.&lt;br /&gt;
Interactive mode allows you to test out and see what Python will do.&lt;br /&gt;
If you ever feel you need to play with new Python statements, go into&lt;br /&gt;
interactive mode and try them out.&lt;br /&gt;
&lt;br /&gt;
=== Creating and Running Programs ===&lt;br /&gt;
&lt;br /&gt;
Go into IDLE if you are not already. In the menu at the top, select ''File'' then ''New File''. In the new window that appears, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Hello, World!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save the program: select ''File'' from the menu, then ''Save''. Save it as &amp;quot;&amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt;&amp;quot; (you can save it in any folder you want). Now that it is saved it can be run. &lt;br /&gt;
&lt;br /&gt;
Next run the program by going to ''Run'' then ''Run Module'' (or if you have an older version of IDLE use ''Edit'' then ''Run script''). This will output &amp;lt;code&amp;gt;Hello, World!&amp;lt;/code&amp;gt; on the ''*Python Shell*'' window. &lt;br /&gt;
&lt;br /&gt;
For a more in-depth introduction to IDLE, a longer tutorial with screenshots can be found at http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html.&lt;br /&gt;
&lt;br /&gt;
==== Program file names ====&lt;br /&gt;
It is very useful to stick to some rules regarding the file names of Python programs. Otherwise some things ''might'' go wrong unexpectedly. These don't matter as much for programs, but you can have weird problems if you don't follow them for module names (modules will be discussed later).&lt;br /&gt;
# Always save the program with the extension &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;. Do not put another dot anywhere else in the file name.&lt;br /&gt;
# Only use standard characters for file names: letters, numbers, dash (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) and underscore (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# White space (&amp;quot;&amp;lt;tt&amp;gt; &amp;lt;/tt&amp;gt;&amp;quot;) should not be used at all (use underscores instead).&lt;br /&gt;
# Do not use anything other than a letter (particularly no numbers!) at the beginning of a file name.&lt;br /&gt;
# Do not use &amp;quot;non-English&amp;quot; characters (such as &amp;lt;tt&amp;gt;å&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ɓ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ç&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ð&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;é&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;õ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ü&amp;lt;/tt&amp;gt;) in your file names—or, even better, do not use them at all when programming.&lt;br /&gt;
# Do not use module names for file names (such as &amp;lt;tt&amp;gt;print.py&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;math.py&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;list.py&amp;lt;/tt&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
=== Using Python from the command line ===&lt;br /&gt;
If you don't want to use Python from the command line, you don't have to, just use IDLE. To get into interactive mode just type &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt; without any arguments. To run a program, create it with a text editor (Emacs has a good Python mode) and then run it with &amp;lt;code&amp;gt;python3 ''program_name''&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Running Python Programs in *nix ====&lt;br /&gt;
&lt;br /&gt;
If you are using Unix (such as Linux, Mac OS, or BSD), if you make the program executable with [[w:chmod|chmod]], and have as the first line:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
you can run the python program with &amp;lt;code&amp;gt;./hello.py&amp;lt;/code&amp;gt; like any other command.&lt;br /&gt;
&lt;br /&gt;
=== Where to get help ===&lt;br /&gt;
At some point in your Python career you will probably get stuck and have no clue about how to solve the problem you are supposed to work on. This tutorial only covers the basics of Python programming, but there is a lot of further information available.&lt;br /&gt;
&lt;br /&gt;
==== Python documentation ====&lt;br /&gt;
First of all, Python is very well documented. There might even be copies of these documents on your computer that came with your Python installation:&lt;br /&gt;
* The official [http://docs.python.org/3/tutorial/ Python 3 Tutorial] by Guido van Rossum is often a good starting point for general questions.&lt;br /&gt;
* For questions about standard modules (you will learn what these are later), the [http://docs.python.org/3/library/ Python 3 Library Reference] is the place to look.&lt;br /&gt;
* If you really want to get to know something about the details of the language, the [http://docs.python.org/3/reference/ Python 3 Reference Manual] is comprehensive but quite complex for beginners.&lt;br /&gt;
&lt;br /&gt;
==== Python user community ====&lt;br /&gt;
There are a lot of other Python users out there, and usually they are nice and willing to help you. This very active user community is organised mostly through mailing lists and a newsgroup:&lt;br /&gt;
* The [http://mail.python.org/mailman/listinfo/tutor tutor mailing list] is for folks who want to ask questions regarding how to learn computer programming with the Python language.&lt;br /&gt;
* The [http://www.python.org/community/lists/#python-help python-help mailing list] is python.org's help desk. You can ask a group of knowledgeable volunteers questions about all your Python problems.&lt;br /&gt;
* The Python newsgroup [news:comp.lang.python comp.lang.python] ([http://groups.google.com/group/comp.lang.python/ Google groups archive]) is the place for general Python discussions, questions and the central meeting point of the community.&lt;br /&gt;
* Python wiki has a [http://wiki.python.org/moin/LocalUserGroups list of local user groups], you can join the group mailing list and ask questions. You can also participate in the user group meetings.&lt;br /&gt;
* [https://www.reddit.com/r/learnpython LearnPython] subreddit is another location where beginner level questions can be asked.&lt;br /&gt;
&lt;br /&gt;
In order not to reinvent the wheel and discuss the same questions again and again, people will appreciate very much if you ''do a web search for a solution to your problem before contacting these lists!''&lt;br /&gt;
&lt;br /&gt;
====== Using python online ======&lt;br /&gt;
If you don't want to download python, or you are using a computer that you cannot download programs on, such as a chromebook, you can use one of the many available online python editors. {{navigation |previous=Front matter |next=Hello, World}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3001</id>
		<title>Python Vadovėlis/Įvadas</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3001"/>
		<updated>2021-09-13T09:56:04Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== First things first ===&lt;br /&gt;
So, you've never programmed before. As we go through this tutorial, I&lt;br /&gt;
will attempt to teach you how to program. There really is only one&lt;br /&gt;
way to learn to program. '''You''' must read ''code'' and write ''code'' (as computer programs are often called).&lt;br /&gt;
I'm going to show you lots of code. You should type in code that I&lt;br /&gt;
show you to see what happens. Play around with it and make changes.&lt;br /&gt;
The worst that can happen is that it won't work. When I type in code&lt;br /&gt;
it will be formatted like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python is easy to learn&lt;br /&gt;
print(&amp;quot;Hello, World!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's so it is easy to distinguish from the other text. If you're reading this on the Web, you'll notice the code is in color -- that's just to make it stand out, and to make the different parts of the code stand out from each other. The code you enter will probably not be colored, or the colors may be different, but it won't affect the code as long as you enter it the same way as it's printed here.&lt;br /&gt;
&lt;br /&gt;
If the computer prints something out it will be formatted like this:&lt;br /&gt;
&lt;br /&gt;
 Hello, World!&lt;br /&gt;
&lt;br /&gt;
(Note that printed text goes to your screen, and does not involve paper. Before computers had screens, the output of computer programs would be printed on paper.)&lt;br /&gt;
&lt;br /&gt;
Note that this is a Python 3 tutorial, which means that most of the examples will not work in Python 2.7 and before. As well, all but a small number of the extra Python 2.7 libraries (third-party libraries) have been converted to Python 3. Most likely you will want to learn Python 3, but if you are learning Python for a specific package or set of modules that are only written in Python 2.7, you may want to consider learning from the [[Non-Programmer's Tutorial for Python 2.6]]. However, the differences between Python 2 and 3 are not particularly large, so if you learn one, you should be able to read programs written for the other without much difficulty. &lt;br /&gt;
&lt;br /&gt;
There will often be a mixture of the text you type (which is shown in '''bold''') and the text the program prints to the screen, which would look like this:&lt;br /&gt;
&lt;br /&gt;
 Halt!&lt;br /&gt;
 Who Goes there? '''Josh'''&lt;br /&gt;
 You may pass, Josh&lt;br /&gt;
&lt;br /&gt;
(Some of the tutorial has not been converted to this format. Since this is a wiki, you can convert it when you find it.)&lt;br /&gt;
&lt;br /&gt;
I will also introduce you to the terminology of programming - for example, that programming is often referred to as ''coding'' or ''hacking''. This will not only help you understand what programmers are talking about, but also help the learning process.&lt;br /&gt;
&lt;br /&gt;
Now, on to more important things. In order to program in Python you need the Python 3 software. If you don't already have the Python software go to [http://www.python.org/download/ www.python.org/download] and get the proper version for your platform. Download it, read the instructions and get it installed.&lt;br /&gt;
&lt;br /&gt;
=== Installing Python ===&lt;br /&gt;
For Python programming you need a working Python installation and a text editor. Python comes with its own editor, ''IDLE'', which is quite nice and totally sufficient for the beginning. As you get more into programming, you will probably switch to some other editor like &amp;lt;tt&amp;gt;nano&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;emacs&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;vi&amp;lt;/tt&amp;gt; or another.&lt;br /&gt;
&lt;br /&gt;
The Python download page is http://www.python.org/download. The most recent version is Python 3.9.6 (as of July 2021); '''Python 2.7 and older versions will not work with this tutorial.''' There are various different installation files for different computer platforms available on the download site. Here are some specific instructions for the most common operating systems:&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, and Unix users ====&lt;br /&gt;
You are probably lucky and Python is already installed on your machine. To test it type &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt; on a command line. If you see something like what is shown [[#Interactive Mode|in the following section]], you are set.&lt;br /&gt;
&lt;br /&gt;
IDLE may need to be installed separately, from its own package such as &amp;lt;tt&amp;gt;idle3&amp;lt;/tt&amp;gt; or as part of &amp;lt;tt&amp;gt;python-tools&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If you have to install Python, first try to use the operating system's package manager or go to the repository where your packages are available and get Python 3. Python 3.0 was released in December 2008; all distributions should have Python 3 available, so you may not need to compile it from scratch. Ubuntu and Fedora do have Python 3 binary packages available, but they are not yet the default, so they need to be installed specially.&amp;lt;!-- Is this realistic for people who don't know how to program???  --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Roughly, here are the steps to compile Python from source code in Unix (If these totally don't make sense, you may want to read another introduction to *nix, such as [http://tldp.org/LDP/intro-linux/html/index.html Introduction to Linux]):&lt;br /&gt;
* Download the .tgz file (use your Web browser to get the gzipped tar file from https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz)&lt;br /&gt;
* Uncompress the tar file (put in the correct path to where you downloaded it):&lt;br /&gt;
 $ tar -xvzf ~/Download/Python-3.7.4.tgz&lt;br /&gt;
 ''... list of files as they are uncompressed ''&lt;br /&gt;
* Change to the directory and tell the computer to compile and install the program&lt;br /&gt;
 $ cd Python-3.7/&lt;br /&gt;
 $ ./configure --prefix=$HOME/python3_install&lt;br /&gt;
 '' ... lots of output.  Watch for error messages here ... ''&lt;br /&gt;
 $ make&lt;br /&gt;
 '' ... even more output.  Hopefully no error messages ... ''&lt;br /&gt;
 $ make install&lt;br /&gt;
* Add Python 3 to your path. You can test it first by specifying the full path. You should add $HOME/python3_install/bin to your PATH bash variable.&lt;br /&gt;
 $ ~/python3_install/bin/python3&lt;br /&gt;
 Python 3.7.4 (... size and date information ...)&lt;br /&gt;
 [GCC 9.1.0] on linux&lt;br /&gt;
 Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
The above commands will install Python 3 to your home directory, which is probably what you want, but if you skip the &amp;lt;tt&amp;gt;--prefix=$HOME/python3_install&amp;lt;/tt&amp;gt;, it will install it to &amp;lt;tt&amp;gt;/usr/local&amp;lt;/tt&amp;gt;. If you want to use the IDLE graphical code editor, you need to make sure that the &amp;lt;tt&amp;gt;tk&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;tcl&amp;lt;/tt&amp;gt; libraries, together with their development files, are installed on the system.  You will get a warning during the &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt; phase if these are not available.&lt;br /&gt;
&lt;br /&gt;
==== Mac users ====&lt;br /&gt;
Starting from Mac OS X Tiger (10.4), versions of Python 2 shipped with the operating system by default, but you will need to also install Python 3 unless Mac OS starts including Python 3 (check the version by starting &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt; in a command line terminal). Also IDLE (the Python editor) might be missing in the standard installation. If you want to (re-)install Python, get the Mac OS installer from the [https://www.python.org/downloads/release/python-380/ Python download site].&lt;br /&gt;
&lt;br /&gt;
==== Windows users ====&lt;br /&gt;
Download the appropriate Windows installer (the [https://www.python.org/ftp/python/3.4.3/python-3.4.3.msi x86 MSI installer], if you do not have a 64-bit AMD or Intel chip).  Start the installer by double-clicking it and follow the prompts.&lt;br /&gt;
&lt;br /&gt;
See https://docs.python.org/3/using/windows.html#installing-python for more information.&lt;br /&gt;
&lt;br /&gt;
===== Configuring your PATH environment variable =====&lt;br /&gt;
&lt;br /&gt;
The PATH environment variable is a list of folders, separated by semicolons, in which Windows will look for a program whenever you try to execute one by typing its name at a Command Prompt. You can see the current value of your PATH by typing this command at a Command Prompt:&lt;br /&gt;
&lt;br /&gt;
 echo %PATH%&lt;br /&gt;
&lt;br /&gt;
The easiest way to permanently change environment variables is to bring up the built-in environment variable editor in Windows.  How you get to this editor is slightly different on different versions of Windows.&lt;br /&gt;
&lt;br /&gt;
'''On Windows 8''' or '''Windows 10''': Press the Windows key and type ''Control Panel'' to locate the Windows Control Panel.  Once you've opened the Control Panel, select View by: Large Icons, then click on ''System''.  In the window that pops up, click the ''Advanced System Settings'' link, then click the ''Environment Variables...'' button.&lt;br /&gt;
&lt;br /&gt;
'''On Windows 7''' or '''Vista''': Click the Start button in the lower-left corner of the screen, move your mouse over ''Computer'', right-click, and select ''Properties'' from the pop-up menu. Click the ''Advanced System Settings'' link, then click the ''Environment Variables...'' button.&lt;br /&gt;
&lt;br /&gt;
Once you've brought up the environment variable editor, you'll do the same thing regardless of which version of Windows you're running. Under ''System Variables'' in the bottom half of the editor, find a variable called &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. If there is is one, select it and click ''Edit...''. Assuming your Python root is &amp;lt;tt&amp;gt;C:\Python37&amp;lt;/tt&amp;gt;, add these two folders to your path (and make sure you get the semicolons right; there should be a semicolon between each folder in the list):&lt;br /&gt;
&lt;br /&gt;
 C:\Python37&lt;br /&gt;
 C:\Python37\Scripts&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
If you want to double-click and start your Python programs from a Windows folder and not have the console window disappear, you can add the following code to the bottom of each script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#stops console from exiting&lt;br /&gt;
end_prog = &amp;quot;&amp;quot;&lt;br /&gt;
while end_prog != &amp;quot;q&amp;quot;:&lt;br /&gt;
        end_prog = input(&amp;quot;type q to quit&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Interactive Mode ===&lt;br /&gt;
Go into IDLE (also called the Python GUI). You should see a window that has some text like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Python 3.0 (r30:67503, Dec 29 2008, 21:31:07) &lt;br /&gt;
[GCC 4.3.2 20081105 (Red Hat 4.3.2-7)] on linux2&lt;br /&gt;
Type &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license()&amp;quot; for more information.&lt;br /&gt;
&lt;br /&gt;
    ****************************************************************&lt;br /&gt;
    Personal firewall software may warn about the connection IDLE&lt;br /&gt;
    makes to its subprocess using this computer's internal loopback&lt;br /&gt;
    interface.  This connection is not visible on any external&lt;br /&gt;
    interface and no data is sent to or received from the Internet.&lt;br /&gt;
    ****************************************************************&lt;br /&gt;
    &lt;br /&gt;
IDLE 3.0      &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; is Python's way of telling you that you are in&lt;br /&gt;
interactive mode. In interactive mode what you type is immediately&lt;br /&gt;
run. Try typing &amp;lt;code&amp;gt;1+1&amp;lt;/code&amp;gt; in. Python will respond with &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;.&lt;br /&gt;
Interactive mode allows you to test out and see what Python will do.&lt;br /&gt;
If you ever feel you need to play with new Python statements, go into&lt;br /&gt;
interactive mode and try them out.&lt;br /&gt;
&lt;br /&gt;
=== Creating and Running Programs ===&lt;br /&gt;
&lt;br /&gt;
Go into IDLE if you are not already. In the menu at the top, select ''File'' then ''New File''. In the new window that appears, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Hello, World!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save the program: select ''File'' from the menu, then ''Save''. Save it as &amp;quot;&amp;lt;code&amp;gt;hello.py&amp;lt;/code&amp;gt;&amp;quot; (you can save it in any folder you want). Now that it is saved it can be run. &lt;br /&gt;
&lt;br /&gt;
Next run the program by going to ''Run'' then ''Run Module'' (or if you have an older version of IDLE use ''Edit'' then ''Run script''). This will output &amp;lt;code&amp;gt;Hello, World!&amp;lt;/code&amp;gt; on the ''*Python Shell*'' window. &lt;br /&gt;
&lt;br /&gt;
For a more in-depth introduction to IDLE, a longer tutorial with screenshots can be found at http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html.&lt;br /&gt;
&lt;br /&gt;
==== Program file names ====&lt;br /&gt;
It is very useful to stick to some rules regarding the file names of Python programs. Otherwise some things ''might'' go wrong unexpectedly. These don't matter as much for programs, but you can have weird problems if you don't follow them for module names (modules will be discussed later).&lt;br /&gt;
# Always save the program with the extension &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;. Do not put another dot anywhere else in the file name.&lt;br /&gt;
# Only use standard characters for file names: letters, numbers, dash (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) and underscore (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# White space (&amp;quot;&amp;lt;tt&amp;gt; &amp;lt;/tt&amp;gt;&amp;quot;) should not be used at all (use underscores instead).&lt;br /&gt;
# Do not use anything other than a letter (particularly no numbers!) at the beginning of a file name.&lt;br /&gt;
# Do not use &amp;quot;non-English&amp;quot; characters (such as &amp;lt;tt&amp;gt;å&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ɓ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ç&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ð&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;é&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;õ&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ü&amp;lt;/tt&amp;gt;) in your file names—or, even better, do not use them at all when programming.&lt;br /&gt;
# Do not use module names for file names (such as &amp;lt;tt&amp;gt;print.py&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;math.py&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;list.py&amp;lt;/tt&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
=== Using Python from the command line ===&lt;br /&gt;
If you don't want to use Python from the command line, you don't have to, just use IDLE. To get into interactive mode just type &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt; without any arguments. To run a program, create it with a text editor (Emacs has a good Python mode) and then run it with &amp;lt;code&amp;gt;python3 ''program_name''&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Running Python Programs in *nix ====&lt;br /&gt;
&lt;br /&gt;
If you are using Unix (such as Linux, Mac OS, or BSD), if you make the program executable with [[w:chmod|chmod]], and have as the first line:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
you can run the python program with &amp;lt;code&amp;gt;./hello.py&amp;lt;/code&amp;gt; like any other command.&lt;br /&gt;
&lt;br /&gt;
=== Where to get help ===&lt;br /&gt;
At some point in your Python career you will probably get stuck and have no clue about how to solve the problem you are supposed to work on. This tutorial only covers the basics of Python programming, but there is a lot of further information available.&lt;br /&gt;
&lt;br /&gt;
==== Python documentation ====&lt;br /&gt;
First of all, Python is very well documented. There might even be copies of these documents on your computer that came with your Python installation:&lt;br /&gt;
* The official [http://docs.python.org/3/tutorial/ Python 3 Tutorial] by Guido van Rossum is often a good starting point for general questions.&lt;br /&gt;
* For questions about standard modules (you will learn what these are later), the [http://docs.python.org/3/library/ Python 3 Library Reference] is the place to look.&lt;br /&gt;
* If you really want to get to know something about the details of the language, the [http://docs.python.org/3/reference/ Python 3 Reference Manual] is comprehensive but quite complex for beginners.&lt;br /&gt;
&lt;br /&gt;
==== Python user community ====&lt;br /&gt;
There are a lot of other Python users out there, and usually they are nice and willing to help you. This very active user community is organised mostly through mailing lists and a newsgroup:&lt;br /&gt;
* The [http://mail.python.org/mailman/listinfo/tutor tutor mailing list] is for folks who want to ask questions regarding how to learn computer programming with the Python language.&lt;br /&gt;
* The [http://www.python.org/community/lists/#python-help python-help mailing list] is python.org's help desk. You can ask a group of knowledgeable volunteers questions about all your Python problems.&lt;br /&gt;
* The Python newsgroup [news:comp.lang.python comp.lang.python] ([http://groups.google.com/group/comp.lang.python/ Google groups archive]) is the place for general Python discussions, questions and the central meeting point of the community.&lt;br /&gt;
* Python wiki has a [http://wiki.python.org/moin/LocalUserGroups list of local user groups], you can join the group mailing list and ask questions. You can also participate in the user group meetings.&lt;br /&gt;
* [https://www.reddit.com/r/learnpython LearnPython] subreddit is another location where beginner level questions can be asked.&lt;br /&gt;
&lt;br /&gt;
In order not to reinvent the wheel and discuss the same questions again and again, people will appreciate very much if you ''do a web search for a solution to your problem before contacting these lists!''&lt;br /&gt;
&lt;br /&gt;
====== Using python online ======&lt;br /&gt;
If you don't want to download python, or you are using a computer that you cannot download programs on, such as a chromebook, you can use one of the many available online python editors. {{navigation |previous=Front matter |next=Hello, World}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:BookCat/core&amp;diff=3000</id>
		<title>Šablonas:BookCat/core</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:BookCat/core&amp;diff=3000"/>
		<updated>2021-09-13T09:54:54Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=2999</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=2999"/>
		<updated>2021-09-13T09:53:42Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;'''{{SUBPAGENAME}}'''&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=2998</id>
		<title>Šablonas:Navigation</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:Navigation&amp;diff=2998"/>
		<updated>2021-09-13T09:52:49Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;!--&lt;br /&gt;
START TABLE&lt;br /&gt;
--&amp;gt;&amp;lt;table style=&amp;quot;width: 100%; clear: both; background-color:#fff !important; border-collapse: collapse; font-size:95%; border: 1px solid rgb(170, 170, 170);&amp;quot; cellpadding=&amp;quot;2&amp;quot; class=&amp;quot;noprint&amp;quot;&amp;gt;&amp;lt;!--&lt;br /&gt;
If on a subpage, show page one level up. --&amp;gt;&lt;br /&gt;
{{#ifeq:{{PAGENAME}}|{{BASEPAGENAME}}||&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;3&amp;quot; style=&amp;quot;text-align: center; font-style: italic;&amp;quot;&amp;gt;[[{{#titleparts:{{FULLPAGENAME}}|-1}}]]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&amp;lt;!--&lt;br /&gt;
End if on subpage.&lt;br /&gt;
ROW TWO: --&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: left; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{previous|BEGINNING}}}|BEGINNING||&amp;amp;nbsp;←&amp;amp;nbsp;[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{previous}}}|{{{previous}}}]]}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: center; width: 33%&amp;quot;&amp;gt;'''{{SUBPAGENAME}}'''&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;text-align: right; width: 33%&amp;quot;&amp;gt;{{#ifeq:{{{next|END}}}|END||[[{{#titleparts:{{FULLPAGENAME}}|1}}/{{{next}}}|{{{next}}}]]&amp;amp;nbsp;→&amp;amp;nbsp;}}&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;!--&lt;br /&gt;
END TABLE&lt;br /&gt;
--&amp;gt;{{#if: {{{cat|}}}|[[Category:{{{cat}}}|{{BOOKSORTKEY}}]]|{{BookCat}}}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{documentation}}&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Don't forget to change the doc after edits, including the static display copy of this template. (I know, it's not ideal, but this way it's possible to show informative names and the &amp;quot;Book Title.&amp;quot;)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=%C5%A0ablonas:BookCat/core&amp;diff=2997</id>
		<title>Šablonas:BookCat/core</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=%C5%A0ablonas:BookCat/core&amp;diff=2997"/>
		<updated>2021-09-13T09:51:17Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:TScope|override|BookCat/{{#switch:{{{namespace}}}&lt;br /&gt;
|{{TALKSPACE:{{{namespace}}}:{{{pagename}}}}}=talk&lt;br /&gt;
|Category =category&lt;br /&gt;
|Subject  =subject&lt;br /&gt;
|Template =template&lt;br /&gt;
|User     =user&lt;br /&gt;
|Wikibooks=category&lt;br /&gt;
|={{evalx|&lt;br /&gt;
    (let (x (get-arg 2))&lt;br /&gt;
      (if (equal? (get-substring x 1 11) &amp;quot;Department:&amp;quot;)&lt;br /&gt;
          &amp;quot;department&amp;quot;&lt;br /&gt;
          (if (equal? (get-substring x 1 6) &amp;quot;Shelf:&amp;quot;)&lt;br /&gt;
              &amp;quot;shelf&amp;quot;&lt;br /&gt;
              &amp;quot;default&amp;quot;)))&lt;br /&gt;
    |{{ucfirst:{{{pagename}}}}}}}&lt;br /&gt;
|#default =default&lt;br /&gt;
}}}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vadov%C4%97lis/Authors&amp;diff=2996</id>
		<title>Vadovėlis/Authors</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vadov%C4%97lis/Authors&amp;diff=2996"/>
		<updated>2021-09-13T09:44:35Z</updated>

		<summary type="html">&lt;p&gt;Mantas: Mantas pervadino puslapį Vadovėlis/Authors į Vadovėlis/Autoriai&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#PERADRESAVIMAS [[Vadovėlis/Autoriai]]&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Autoriai&amp;diff=2995</id>
		<title>Python Vadovėlis/Autoriai</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Autoriai&amp;diff=2995"/>
		<updated>2021-09-13T09:44:35Z</updated>

		<summary type="html">&lt;p&gt;Mantas: Mantas pervadino puslapį Vadovėlis/Authors į Vadovėlis/Autoriai&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Originalaus (angliško) vadovėlio autoriai&lt;br /&gt;
&lt;br /&gt;
; Josh Cogliati&lt;br /&gt;
: Jrincayc, jjcogliati-jan2007 AT yahoo.com&lt;br /&gt;
&lt;br /&gt;
=== Angliškos versijos bendraautoriai ===&lt;br /&gt;
* Mitchell Aikens, LGIT, WSIT, AAS &lt;br /&gt;
* Kiah Morante &lt;br /&gt;
*Elizabeth Cogliati&lt;br /&gt;
*James A. Brown&lt;br /&gt;
*Joe Oppegaard&lt;br /&gt;
*Benjamin Hell &lt;br /&gt;
&lt;br /&gt;
=== Lietuviškas vertimas ir modifikacija ===&lt;br /&gt;
* Mantas Urbonas, Visma Lietuva&lt;br /&gt;
* Povilas Jeremičius, Visma Lietuva&lt;br /&gt;
* Martynas Teleiša, Visma lietuva&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=BEGINNING |next=Front matter}}&lt;br /&gt;
{{BookCat}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Autoriai&amp;diff=2994</id>
		<title>Python Vadovėlis/Autoriai</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Autoriai&amp;diff=2994"/>
		<updated>2021-09-13T09:44:14Z</updated>

		<summary type="html">&lt;p&gt;Mantas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Originalaus (angliško) vadovėlio autoriai&lt;br /&gt;
&lt;br /&gt;
; Josh Cogliati&lt;br /&gt;
: Jrincayc, jjcogliati-jan2007 AT yahoo.com&lt;br /&gt;
&lt;br /&gt;
=== Angliškos versijos bendraautoriai ===&lt;br /&gt;
* Mitchell Aikens, LGIT, WSIT, AAS &lt;br /&gt;
* Kiah Morante &lt;br /&gt;
*Elizabeth Cogliati&lt;br /&gt;
*James A. Brown&lt;br /&gt;
*Joe Oppegaard&lt;br /&gt;
*Benjamin Hell &lt;br /&gt;
&lt;br /&gt;
=== Lietuviškas vertimas ir modifikacija ===&lt;br /&gt;
* Mantas Urbonas, Visma Lietuva&lt;br /&gt;
* Povilas Jeremičius, Visma Lietuva&lt;br /&gt;
* Martynas Teleiša, Visma lietuva&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=BEGINNING |next=Front matter}}&lt;br /&gt;
{{BookCat}}&lt;/div&gt;</summary>
		<author><name>Mantas</name></author>
	</entry>
</feed>