<?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=Martynas</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=Martynas"/>
	<link rel="alternate" type="text/html" href="https://wiki.angis.net/w/Specialus:Ind%C4%97lis/Martynas"/>
	<updated>2026-05-03T09:13:05Z</updated>
	<subtitle>Naudotojo indėlis</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/Rekursin%C4%97s_funkcijos&amp;diff=3873</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=3873"/>
		<updated>2022-02-15T15:34:24Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Vieniems šis skyrius gali pasirodyti naudingas, o kitiems - painus. Jeigu tau informacija pasirodys paini, tai nesuk galvos ir praleisk,  prie šio skyriaus galėsi grįžti šiek tiek vėliau. O dabar pabandom pasižiūrėti į mūsų parašytą programą:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def daug(a, b): # daug reiškia daugybą&lt;br /&gt;
    if b == 0:&lt;br /&gt;
        return 0&lt;br /&gt;
    lik = daug(a, b - 1) #lik reiškia likutį&lt;br /&gt;
    reikšmė = a + lik&lt;br /&gt;
    return reikšmė&lt;br /&gt;
rezultatas = daug(3, 2)&lt;br /&gt;
print(&amp;quot;3 * 2 = &amp;quot;, rezultatas)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Iš esmės ši programa, tai teigiama sveikųjų skaičių daugybos funkcija (reikia atkreipti dėmesį į tai, kad Python'o programavimo kalboje jau yra integruota funkcija dauginimui, čia mes patys parašėme lengvai suprantamą pavyzdį (jeigu kurtume tokią funkciją patys), kuris parodo kaip atrodo daugybos veiksmas. Šioje programoje gali pamatyti rekursijos naudojimą, tai yra iteracijos (kartojimo) forma, kai funkcija yra pakartotinai iškviečiama, kol bus įvykdyta sukurta išvesties sąlyga. Programa naudoja pakartotinius papildymus, kad gautų tą patį rezultatą kaip ir daugyba: pavyzdžiui 3 + 3 (sudėtis) duoda tą patį rezultatą kaip ir 3 * 2 (daugyba).&lt;br /&gt;
&lt;br /&gt;
; ''Klausimas:'' Ką pirmiausia daro programa?&lt;br /&gt;
: ''Atsakymas:'' Pirmiausia yra aprašyta daugybos funkcija:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def daug(a, b):&lt;br /&gt;
    if b == 0:&lt;br /&gt;
        return 0&lt;br /&gt;
    lik = daug(a, b - 1)&lt;br /&gt;
    reikšmė = a + lik &lt;br /&gt;
    return reikšmė&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
: Ši funkcija paima du parametrus ir grąžina reikšmę. Vėliau šią funkciją galima bus iškviesti.&lt;br /&gt;
; Kas nutinka toliau?  &lt;br /&gt;
: Vykdoma kita eilutė einanti po funkcijos &amp;lt;code&amp;gt;rezultatas = daug(3, 2)&amp;lt;/code&amp;gt;&lt;br /&gt;
; Ką daro ši eilutė?&lt;br /&gt;
: Ši eilutė priskiria funkcijos &amp;lt;code&amp;gt;daug(3, 2)&amp;lt;/code&amp;gt; grąžinamą reikšmę kintamajam &amp;lt;code&amp;gt;rezultatas&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Ką grąžina &amp;lt;code&amp;gt;daug(3, 2)&amp;lt;/code&amp;gt;?&lt;br /&gt;
: Norėdami tai išsiaiškinti, turime peržiūrėti funkciją &amp;lt;code&amp;gt;daug()&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Kas vyksta su kodu?&lt;br /&gt;
: Kintamasis &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; gauna jam priskirtą reikšmę 3, o kintamasis &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; - jam priskirtą reikšmę 2.&lt;br /&gt;
; Kas nutinka tada?&lt;br /&gt;
: Vykdoma eilutė &amp;lt;code&amp;gt;if b == 0:&amp;lt;/code&amp;gt;. Kadangi &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; reikšmė yra 2, todėl eilutė &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt; praleidžiama.&lt;br /&gt;
; Kas vyksta toliau?&lt;br /&gt;
: Vykdoma eilutė &amp;lt;code&amp;gt;lik = daug(a, b - 1)&amp;lt;/code&amp;gt;. Ši eilutė nustato lokalaus kintamojo &amp;lt;code&amp;gt;lik&amp;lt;/code&amp;gt; reikšmę į &amp;lt;code&amp;gt;daug(a, b - 1)&amp;lt;/code&amp;gt; reikšmę. &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; reikšmė yra 3, o &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; - 2, todėl funkcija kviečia funkciją &amp;lt;code&amp;gt;daug(3, 1)&amp;lt;/code&amp;gt;&lt;br /&gt;
; Taigi kokia yra &amp;lt;code&amp;gt;daug(3, 1)&amp;lt;/code&amp;gt; reikšmė?&lt;br /&gt;
: Turime paleisti funkciją &amp;lt;code&amp;gt;daug()&amp;lt;/code&amp;gt; su parametrais, kurie yra 3 ir 1.&lt;br /&gt;
; Kas nutinka toliau?&lt;br /&gt;
: Lokalūs kintamieji vėl pasileidus kodui jau yra nustatyti, todėl &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; reikšmė būtų 3, o &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; reikšmė – 1. Kadangi jie yra lokalūs kintamieji, todėl jie neturi įtakos ankstesnėms &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; ir &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; reikšmėms.&lt;br /&gt;
; Kas įvyksta toliau?&lt;br /&gt;
: Kadangi &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; turi reikšmę 1, if sąlygos rezultatas yra neigiamas, todėl vykdoma kita eilutė &amp;lt;code&amp;gt;lik = daug(a, b - 1)&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Ką daro ši eilutė?&lt;br /&gt;
: Dabar kintamajam &amp;lt;code&amp;gt;lik&amp;lt;/code&amp;gt; priskiriam funkcijos &amp;lt;code&amp;gt;daug(3, 0)&amp;lt;/code&amp;gt; reikšmė.&lt;br /&gt;
; Kokia ši reikšmė?&lt;br /&gt;
: Norėdami tai išsiaiškinti, turime dar kartą paleisti funkciją. Šį kartą &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; reikšmė yra 3, o &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; – 0.&lt;br /&gt;
; Kas vyksta toliau?&lt;br /&gt;
: Pirmoji vykdytinos funkcijos eilutė yra &amp;lt;code&amp;gt;if b == 0:&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; reikšmė 0, todėl kita vykdoma eilutė yra &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt;&lt;br /&gt;
; Ką daro &amp;lt;code&amp;gt;return 0&amp;lt;/code&amp;gt; eilutė?&lt;br /&gt;
: Ši eilutė grąžina funkcijos reikšmę lygią 0 į tą vietą, kur ji buvo iškviesta.&lt;br /&gt;
; Kas iš to?&lt;br /&gt;
: Dabar mes žinome, kad &amp;lt;code&amp;gt;daug(3, 0)&amp;lt;/code&amp;gt; grąžina reikšmę 0. Dar žinome, ką daro eilutė &amp;lt;code&amp;gt;lik = daug(a, b - 1)&amp;lt;/code&amp;gt;, nes paleidžiame funkciją &amp;lt;code&amp;gt;daug()&amp;lt;/code&amp;gt; su parametrais 3 ir 0. Baigiame vykdyti &amp;lt;code&amp;gt;daug(3, 0)&amp;lt;/code&amp;gt; ir dabar vėl pradedame vykdyti &amp;lt;code&amp;gt;daug(3, 1)&amp;lt;/code&amp;gt;. Kintamajam &amp;lt;code&amp;gt;lik&amp;lt;/code&amp;gt; priskiriama reikšmė yra 0.&lt;br /&gt;
; Kurią eilutę kompiuteris skaito po to?&lt;br /&gt;
: Toliau vykdoma eilutė &amp;lt;code&amp;gt;reikšmė = a + lik&amp;lt;/code&amp;gt;. Žinome, kad &amp;lt;code&amp;gt;a = 3&amp;lt;/code&amp;gt; ir &amp;lt;code&amp;gt;lik = 0&amp;lt;/code&amp;gt; todėl dabar &amp;lt;code&amp;gt;reikšmė = 3&amp;lt;/code&amp;gt;. &lt;br /&gt;
; Kas nutinka toliau?&lt;br /&gt;
: Vykdoma eilutė &amp;lt;code&amp;gt;return reikšmė&amp;lt;/code&amp;gt;, kuri grąžina reikšmę 3. Šis skaičius atsiranda iš funkcijos &amp;lt;code&amp;gt;daug (3, 1)&amp;lt;/code&amp;gt; vykdymo. Iškvietus &amp;lt;code&amp;gt;return&amp;lt;/code&amp;gt;, grįžtame prie &amp;lt;code&amp;gt;daug(3, 2)&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Kur yra &amp;lt;code&amp;gt;daug(3, 2)&amp;lt;/code&amp;gt;?&lt;br /&gt;
: Mes turėjome kintamuosius &amp;lt;code&amp;gt;a = 3&amp;lt;/code&amp;gt; ir &amp;lt;code&amp;gt;b = 2&amp;lt;/code&amp;gt; ir nagrinėjome eilutę &amp;lt;code&amp;gt;lik = daug(a, b - 1)&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Kas įvyksta?&lt;br /&gt;
: Kintamajam &amp;lt;code&amp;gt;lik&amp;lt;/code&amp;gt; priskiriama reikšmė 3. Kita eilutė &amp;lt;code&amp;gt;reikšmė = a + lik&amp;lt;/code&amp;gt; priskiria kintamajam &amp;lt;code&amp;gt;reikšmė&amp;lt;/code&amp;gt; reikšmę &amp;lt;code&amp;gt;3 + 3&amp;lt;/code&amp;gt; arba 6.  &lt;br /&gt;
; Kas įvyksta toliau?&lt;br /&gt;
: Pradedama vykdyti kita eilutė, kuri grąžina 6 iš funkcijos. Tuomet grįžtame prie eilutės &amp;lt;code&amp;gt;rezultatas = daug(3, 2)&amp;lt;/code&amp;gt;, kur kintamajam &amp;lt;code&amp;gt;rezultatas&amp;lt;/code&amp;gt; dabar priskiriama reikšmė 6 &lt;br /&gt;
; Kas nutinka toliau?  &lt;br /&gt;
: Paleidžiama kita eilutė po funkcijos &amp;lt;code&amp;gt;print (&amp;quot;3 * 2 =&amp;quot;, rezultatas)&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Ką ji daro?&lt;br /&gt;
: Ji spausdina &amp;lt;code&amp;gt;3 * 2 =&amp;lt;/code&amp;gt; ir &amp;lt;code&amp;gt;rezultatas&amp;lt;/code&amp;gt; reikšmę, kuri yra 6. Visa išspausdinta eilutė yra &amp;lt;code&amp;gt;3 * 2 = 6&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Taigi, kas čia įvyko apskritai?  &lt;br /&gt;
: Iš esmės panaudojome du skirtingus faktus, kad apskaičiuotume dviejų skaičių kartotinį. Pirmas, kad bet koks skaičius padauginus iš nulio yra nulis &amp;lt;code&amp;gt;(x * 0 = 0)&amp;lt;/code&amp;gt;. Antras, kad skaičius padaugintas iš kito skaičiaus yra lygus pirmo skaičiaus ir pirmo bei vienetu mažesnio už antrąjį sandaugos sumai &amp;lt;code&amp;gt;(x * y = x + x * (y - 1))&amp;lt;/code&amp;gt;. Taigi ir čia &amp;lt;code&amp;gt;3 * 2&amp;lt;/code&amp;gt; pirmiausiai paverčiamas į &amp;lt;code&amp;gt;3 + 3 * 1&amp;lt;/code&amp;gt;. Tada &amp;lt;code&amp;gt;3 * 1&amp;lt;/code&amp;gt; paverčiamas į &amp;lt;code&amp;gt;3 + 3 * 0&amp;lt;/code&amp;gt;. Tuomet mes žinome, kad bet kuris skaičius padaugintas iš nulio yra nulis, todėl &amp;lt;code&amp;gt;3 * 0&amp;lt;/code&amp;gt; yra 0. Kai viskas surašoma vienoje eilutėje, gauname &amp;lt;code&amp;gt;3 + 3 + 0 &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Štai kaip viskas veikia:&lt;br /&gt;
&lt;br /&gt;
 daug(3, 2)&lt;br /&gt;
 3 + daug(3, 1)&lt;br /&gt;
 3 + 3 + daug(3, 0)&lt;br /&gt;
 3 + 3 + 0&lt;br /&gt;
 3 + 3&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
==== Rekursija ====&lt;br /&gt;
Funkcijos, kurios kreipiasi pačios į save yra vadinamos rekursinėmis funkcijomis. Šio skyriaus pavyzdžiuose panagrinėsime tokias funkcijas. Tai palengvina programavimo užduočių spendimų įgyvendinimą, nes kartais pakanka apsvarstyti tik vieną problemos žingsnį, o ne visą problemą iš karto. Be to tai leidžia išreikšti kai kurias matematines sąvokas paprastu, lengvai skaitomu kodu.&lt;br /&gt;
&lt;br /&gt;
Bet kokią problemą, kurią galime išspręsti naudojant rekursiją, gali būti išspręsta naudojant ciklus. Jie veikia greičiau, bet kartais ciklus sunku atlikti teisingai.&lt;br /&gt;
&lt;br /&gt;
Turbūt intuityviausias „rekursijos“ apibrėžimas yra toks:&lt;br /&gt;
  REKURSIJA&lt;br /&gt;
     Jei vis dar nesupranti, tai skaityk: REKURSIJA.&lt;br /&gt;
Pabandyk perskaityti dar kelis pavyzdžius.&lt;br /&gt;
&lt;br /&gt;
=== Pavyzdžiai ===&lt;br /&gt;
'''faktorialas.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#apibrėžia funkciją, kuri apskaičiuoja koeficientą&lt;br /&gt;
&lt;br /&gt;
def faktorialas(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;Klaida, neigiami skaičiai neturi faktorialo reikšmių!!&amp;quot;&lt;br /&gt;
    return n * faktorialas(n - 1)&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;2! =&amp;quot;, faktorialas(2))&lt;br /&gt;
print(&amp;quot;3! =&amp;quot;, faktorialas(3))&lt;br /&gt;
print(&amp;quot;4! =&amp;quot;, faktorialas(4))&lt;br /&gt;
print(&amp;quot;5! =&amp;quot;, faktorialas(5))&lt;br /&gt;
print(&amp;quot;-3! =&amp;quot;, faktorialas(-3))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&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! = Klaida, neigiami skaičiai neturi faktorialo reikšmių!!&lt;br /&gt;
&lt;br /&gt;
'''atgalinis_skaičiavimas.py'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def atgalinis_skaičiavimas(n):&lt;br /&gt;
    print(n)&lt;br /&gt;
    if n &amp;gt; 0:&lt;br /&gt;
        return atgalinis_skaičiavimas(n-1)&lt;br /&gt;
&lt;br /&gt;
atgalinis_skaičiavimas(5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rezultatas:&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;!-- Dabar pabandyk žodį &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt;(lietuviškai jei) pakeisti žodžiu &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; (lietuviškai kol). Pamatysi, kad kompiuteris pavirto skaičiuotuvu, kuris negali suskaičiuoti iki keturių. Iš esmės &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt;(kol) veikia kaip &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; (jei) ir &amp;lt;code&amp;gt;repeat&amp;lt;/code&amp;gt;(angl. pakartok) kartu sudėjus.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{navigation |previous=Funkcijų apibrėžimas |next=Sąrašai}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3871</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=3871"/>
		<updated>2022-02-15T11:32:41Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python, bei norintiems praplėsti žinias.&lt;br /&gt;
&lt;br /&gt;
Tėra vienintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk vykdyti šį kodą kompiuteriu ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus. Nebijok kažką sugandinti, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš pats rašysiu kodą knygoje, jį suformatuosiu šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prieš komentarą – paparastą tekstą – dėsiu groteles. Šitaip lengvai atskirsi kodo pavyzdžius nuo teksto. Jei skaitai internetinį knygos variantą, atkreipk dėmesį į kodo spalvą – ji kitokia, tam kad tam tikros kodo dalys išsiskirtų. Tau vedant kodą kompiuteriu redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet jei įvesi kodą, taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiui, vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Vadovėlyje tave supažindinsiu ir su programavimo terminologiją. Tai ne tik tau padės suprasti apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne Windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių Linux operacinei sistemai galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minutes kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje:&lt;br /&gt;
&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Tokiu pat principu galėsi kurti ir kitas programas.&lt;br /&gt;
&lt;br /&gt;
==== Programų failų pavadinimai ====&lt;br /&gt;
 Kuriant naujus Python kodo failus labai naudinga laikytis tam tikrų taisyklių, parenkant failų pavadinimus. Nesilaikant šių taisyklių gali atsitkti taip kad programa &amp;quot;netikėtai&amp;quot; neveiks.&lt;br /&gt;
# Visada naudok failo plėtinį &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Naudok vieintelį tašką - plėtinio atskyrimui&lt;br /&gt;
# Naudok tik: raides, skaičius, brūkšnį (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) ir pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# Nenaudok tarpų (zodziams atskirti galima naudoti pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Failo pavadinimą pradėk raide&lt;br /&gt;
# Nenaudok standartinių Python komandų pavadinimų (pvz. &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;
=== Python paleidimas per komandinę eilutę ===&lt;br /&gt;
Python programinį kodą galima vykdyti ir naudojant komandinę eilutę. Sukūrus failą su programos kodu ją įvykdyti galima komandinėj eilutėj vykdant komandą: &amp;lt;code&amp;gt;python ''failo_pavadinimas''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 8.jpg|frame|kairėje]]&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3870</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=3870"/>
		<updated>2022-02-15T11:23:19Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python, bei norintiems praplėsti žinias.&lt;br /&gt;
&lt;br /&gt;
Tėra vienintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk vykdyti šį kodą kompiuteriu ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus. Nebijok kažką sugandinti, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš pats rašysiu kodą knygoje, jį suformatuosiu šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prieš komentarą – paparastą tekstą – dėsiu groteles. Šitaip lengvai atskirsi kodo pavyzdžius nuo teksto. Jei skaitai internetinį knygos variantą, atkreipk dėmesį į kodo spalvą – ji kitokia, tam kad tam tikros kodo dalys išsiskirtų. Tau vedant kodą kompiuteriu redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet jei įvesi kodą, taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiui, vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Vadovėlyje tave supažindinsiu ir su programavimo terminologiją. Tai ne tik tau padės suprasti apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne Windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių Linux operacinei sistemai galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minutes kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje:&lt;br /&gt;
&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Tokiu pat principu galėsi kurti ir kitas programas.&lt;br /&gt;
&lt;br /&gt;
==== Programų failų pavadinimai ====&lt;br /&gt;
 Kuriant naujus Python kodo failus labai naudinga laikytis taisyklių, pavadinant savo programas. Nesilaikant šių taisyklių gali atsitkti taip kad programa &amp;quot;netikėtai&amp;quot; neveiks.&lt;br /&gt;
# Visada naudok failo plėtinį &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Naudok vieintelį tašką - plėtinio atskyrimui&lt;br /&gt;
# Naudok tik: raides, skaičius, brūkšnį (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) ir pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# Nenaudok tarpų (zodziams atskirti galima naudoti pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Failo pavadinimas turi prasidėti raide&lt;br /&gt;
# Nenaudok standartinių Python komandų pavadinimų (pvz. &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;
=== Python paleidimas per komandinę eilutę ===&lt;br /&gt;
Python programinį kodą galima vykdyti ir naudojant komandinę eilutę. Sukūrus failą su programos kodu ją įvykdyti galima komandinėj eilutėj vykdant komandą: &amp;lt;code&amp;gt;python ''failo_pavadinimas''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 8.jpg|frame|kairėje]]&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3795</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=3795"/>
		<updated>2022-01-21T12:42:16Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python, bei norintiems praplėsti žinias.&lt;br /&gt;
&lt;br /&gt;
Tėra vienintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk vykdyti šį kodą lompiuteriu ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus. Nebijok kažką sugandinti, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš pats rašysiu kodą knygoje, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia, tam kad tam tikros kodo dalys išsiskirtų. Tau vedant kodą kompiuteriu redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet jei įvesi kodą, taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiui, vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Tokiu pat principu galėsi kurti ir kitas programas.&lt;br /&gt;
&lt;br /&gt;
==== Programų failų pavadinimai ====&lt;br /&gt;
 Kuriant naujus Python kodo failus labai naudinga laikytis taisyklių, pavadinant savo programas. Nesilaikant šių taisyklių gali atsitkti taip kad programa &amp;quot;netikėtai&amp;quot; neveiks.&lt;br /&gt;
# Visada naudok failo plėtinį &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Naudok vieintelį tašką - plėtinio atskyrimui&lt;br /&gt;
# Naudok tik: raides, skaičius, brūkšnį (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) ir pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# Nenaudok tarpų (zodziams atskirti galima naudoti pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Failo pavadinimas turi prasidėti raide&lt;br /&gt;
# Nenaudok standartinių Python modulių pavadinimų (pvz. &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;
=== Python paleidimas per komandinę eilutę ===&lt;br /&gt;
Python programinį kodą galima vykdyti ir naudojant komandinę eilutę. Sukūrus failą su programos kodu ją įvykdyti galima komandinėj eilutėj vykdant komandą: &amp;lt;code&amp;gt;python ''programos_pavadinimas''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 8.jpg|frame|kairėje]]&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3794</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=3794"/>
		<updated>2022-01-21T12:37:21Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python, bei norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Tokiu pat principu galėsi kurti ir kitas programas.&lt;br /&gt;
&lt;br /&gt;
==== Programų failų pavadinimai ====&lt;br /&gt;
 Kuriant naujus Python kodo failus labai naudinga laikytis taisyklių, pavadinant savo programas. Nesilaikant šių taisyklių gali atsitkti taip kad programa &amp;quot;netikėtai&amp;quot; neveiks.&lt;br /&gt;
# Visada naudok failo plėtinį &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Naudok vieintelį tašką - plėtinio atskyrimui&lt;br /&gt;
# Naudok tik: raides, skaičius, brūkšnį (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) ir pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# Nenaudok tarpų (zodziams atskirti galima naudoti pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Failo pavadinimas turi prasidėti raide&lt;br /&gt;
# Nenaudok standartinių Python modulių pavadinimų (pvz. &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;
=== Python paleidimas per komandinę eilutę ===&lt;br /&gt;
Python programinį kodą galima vykdyti ir naudojant komandinę eilutę. Sukūrus failą su programos kodu ją įvykdyti galima komandinėj eilutėj vykdant komandą: &amp;lt;code&amp;gt;python ''programos_pavadinimas''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 8.jpg|frame|kairėje]]&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3793</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=3793"/>
		<updated>2022-01-18T17:07:04Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Tokiu pat principu galėsi kurti ir kitas programas.&lt;br /&gt;
&lt;br /&gt;
==== Programų failų pavadinimai ====&lt;br /&gt;
 Kuriant naujus Python kodo failus labai naudinga laikytis taisyklių, pavadinant savo programas. Nesilaikant šių taisyklių gali atsitkti taip kad programa &amp;quot;netikėtai&amp;quot; neveiks.&lt;br /&gt;
# Visada naudok failo plėtinį &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Naudok vieintelį tašką - plėtinio atskyrimui&lt;br /&gt;
# Naudok tik: raides, skaičius, brūkšnį (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) ir pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# Nenaudok tarpų (zodziams atskirti galima naudoti pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Failo pavadinimas turi prasidėti raide&lt;br /&gt;
# Nenaudok standartinių Python modulių pavadinimų (pvz. &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;
=== Python paleidimas per komandinę eilutę ===&lt;br /&gt;
Python programinį kodą galima vykdyti ir naudojant komandinę eilutę. Sukūrus failą su programos kodu ją įvykdyti galima komandinėj eilutėj vykdant komandą: &amp;lt;code&amp;gt;python ''programos_pavadinimas''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 8.jpg|frame|kairėje]]&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3792</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=3792"/>
		<updated>2022-01-18T17:04:32Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Tokiu pat principu galėsi kurti ir kitas programas.&lt;br /&gt;
&lt;br /&gt;
==== Programų failų pavadinimai ====&lt;br /&gt;
 Kuriant naujus Python kodo failus labai naudinga laikytis taisyklių, pavadinant savo programas. Nesilaikant šių taisyklių gali atsitkti taip kad programa &amp;quot;netikėtai&amp;quot; neveiks.&lt;br /&gt;
# Visada naudok failo plėtinį &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Naudok vieintelį tašką - plėtinio atskyrimui&lt;br /&gt;
# Naudok tik: raides, skaičius, brūkšnį (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) ir pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# Nenaudok tarpų (zodziams atskirti galima naudoti pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Failo pavadinimas turi prasidėti raide&lt;br /&gt;
# Nenaudok standartinių Python modulių pavadinimų (pvz. &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;
=== Python paleidimas per komandinę eilutę ===&lt;br /&gt;
Python programinį kodą galima vykdyti ir naudojant komandinę eilutę. Sukūrus failą su programos kodu ją įvykdyti galima komandinėj eilutėj vykdant komandą: &amp;lt;code&amp;gt;python3 ''programos_pavadinimas''&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 8.jpg|frame|kairėje]]&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_8.jpg&amp;diff=3791</id>
		<title>Vaizdas:Vadovelis 1Sk 8.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_8.jpg&amp;diff=3791"/>
		<updated>2022-01-18T17:04:19Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Python vykdymas komandinėj eilutėj&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3790</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=3790"/>
		<updated>2022-01-18T16:50:35Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Tokiu pat principu galėsi kurti ir kitas programas.&lt;br /&gt;
&lt;br /&gt;
==== Programų failų pavadinimai ====&lt;br /&gt;
 Kuriant naujus Python kodo failus labai naudinga laikytis taisyklių, pavadinant savo programas. Nesilaikant šių taisyklių gali atsitkti taip kad programa &amp;quot;netikėtai&amp;quot; neveiks.&lt;br /&gt;
# Visada naudok failo plėtinį &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Naudok vieintelį tašką - plėtinio atskyrimui&lt;br /&gt;
# Naudok tik: raides, skaičius, brūkšnį (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) ir pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# Nenaudok tarpų (zodziams atskirti galima naudoti pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Failo pavadinimas turi prasidėti raide&lt;br /&gt;
# Nenaudok standartinių Python modulių pavadinimų (pvz. &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;
 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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3789</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=3789"/>
		<updated>2022-01-18T16:49:30Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Tokiu pat principu galėsi kurti ir kitas programas.&lt;br /&gt;
&lt;br /&gt;
==== Programų failų pavadinimai ====&lt;br /&gt;
Kuriant naujus Python kodo failus labai naudinga laikytis taisyklių, pavadinant savo programas. Nesilaikant šių taisyklių gali atsitkti taip kad programa &amp;quot;netikėtai&amp;quot; neveiks.&lt;br /&gt;
# Visada naudok failo plėtinį &amp;lt;tt&amp;gt;.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Naudok vieintelį tašką - plėtinio atskyrimui&lt;br /&gt;
# Naudok tik: raides, skaičius, brūkšnį (&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;) ir pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;)&lt;br /&gt;
# Nenaudok tarpų (zodziams atskirti galima naudoti pabraukimo simbolį (&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;).&lt;br /&gt;
# Failo pavadinimas turi prasidėti raide&lt;br /&gt;
# Nenaudok standartinių Python modulių pavadinimų (pvz. &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;
 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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3788</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=3788"/>
		<updated>2022-01-18T16:31:13Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 7.jpg|frame|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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;
&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
  &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;
=== 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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_7.jpg&amp;diff=3787</id>
		<title>Vaizdas:Vadovelis 1Sk 7.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_7.jpg&amp;diff=3787"/>
		<updated>2022-01-18T16:31:01Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Vykdymo rezultatas&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3786</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=3786"/>
		<updated>2022-01-18T16:29:05Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:7.jpg|frame|center]]&lt;br /&gt;
[[Vaizdas:7.jpg|miniatiūra|kairėje]]&lt;br /&gt;
[[frameless]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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;
&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
  &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;
=== 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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3785</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=3785"/>
		<updated>2022-01-18T16:28:29Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:7.jpg|frame|center]]&lt;br /&gt;
[[Vaizdas:7.jpg|miniatiūra|kairėje]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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;
&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
  &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;
=== 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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3784</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=3784"/>
		<updated>2022-01-18T16:27:32Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie aplanko paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Pavadink failą &amp;quot;Sveikas.py&amp;quot;&lt;br /&gt;
&lt;br /&gt;
5. Automatiškai atsivers failo redagavimo langas. Jame įrašyk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Paspausk klavišus ctrl + F5, kad paleistum programą&lt;br /&gt;
&lt;br /&gt;
7. Apatinėje skiltyje išvysi programos vykdymo langą, kur matysi ir savo programos vykdymo rezultatą:&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:7.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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;
&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
  &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;
=== 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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:7.jpg&amp;diff=3783</id>
		<title>Vaizdas:7.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:7.jpg&amp;diff=3783"/>
		<updated>2022-01-18T16:27:22Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Vykdymo rezultatas&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3782</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=3782"/>
		<updated>2022-01-18T16:18:12Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Pirmo paleidimo metu programa atliks reikiamus konfigūravimo veiksmus, kad būtų galima pilnai naudotis reikiamais įskiepiais. Todėl pirmo paleidimo metu reikia palaukti kelias minuites kol konfigūravimas bus baigtas.&lt;br /&gt;
&lt;br /&gt;
==== Pirmosios programos sukūrimas ====&lt;br /&gt;
Sukurti pirmąją programą gali vykdydamas šiuos žingsnius Visual Studio Code redaktoriuje&lt;br /&gt;
1. Meniu pasirink Failas &amp;gt;&amp;gt; Atverti aplanką&lt;br /&gt;
2. Pasirink ar susikurk aplanką kuriame laikysi Python programų kodo failus.&lt;br /&gt;
3. Skyriuje '''NARŠYKLĖ''' prie katalogo paspausk ant naujo failo ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 6.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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;
&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
  &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;
=== 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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_6.jpg&amp;diff=3781</id>
		<title>Vaizdas:Vadovelis 1Sk 6.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_6.jpg&amp;diff=3781"/>
		<updated>2022-01-18T16:17:56Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Naujas failas&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3780</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=3780"/>
		<updated>2022-01-18T15:55:11Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Diegimas Windows operacinėse sistemose ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
==== Mac operacinėse sistemose ====&lt;br /&gt;
Nuo Mac OS X Tiger (10.4) versijos, Python 2 yra instaliuojama kartu su operacine sistema. Tad Python 3 reikia įdiegti atskirai (Nebent vėlesnėse versijose pasikeis su operacine sistema diegiamo Python versija). Parsisiųsti Python 3 MAC operacinėms sistemoms galima iš https://www.python.org/downloads/macos/.&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
&lt;br /&gt;
=== Pirmas paleidimas ===&lt;br /&gt;
Windows operacinėse sistemose Visual Studio Code kodo redaktorių gali paleisti paspaudžiant ant darbalaukio atsiradusios ikonėlės.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 5.jpg|miniatiūra]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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;
&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
  &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;
=== 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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_5.jpg&amp;diff=3779</id>
		<title>Vaizdas:Vadovelis 1Sk 5.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_5.jpg&amp;diff=3779"/>
		<updated>2022-01-18T15:55:02Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ikonėlė&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3778</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=3778"/>
		<updated>2022-01-18T15:38:34Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Diegimas Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
Parsiųsti ir įdiegti Visual Studio Code kodo redaktorių galima iš https://code.visualstudio.com/Download&lt;br /&gt;
 &lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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;
&lt;br /&gt;
&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3777</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=3777"/>
		<updated>2022-01-18T15:35:59Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Diegimas Linux, BSD, bei Unix operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Patikrinti ar Python įdiegtas ir kuri versija įdiegta galima įvykdžius komandą:&lt;br /&gt;
&lt;br /&gt;
 python3 --version&lt;br /&gt;
&lt;br /&gt;
Jei Python nėra įdiegtas, tai jį įsidiegti galima naudojantis instrukcija anglų kalba: https://docs.python-guide.org/starting/install3/linux/&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3776</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=3776"/>
		<updated>2022-01-18T15:19:36Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis. Šiame lange paspausk mygtuką '''OK'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
7. Paspausk mygtuką '''Finish''', kad užbaigtum diegimą.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 4.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
==== Diegimas ne Windows operacinėse sistemose ====&lt;br /&gt;
Jei naudoji ne windows operacinę sistemą Python ir kodo redaktorių reikės įsidiegti atskirai.&lt;br /&gt;
Linux, BSD, bei Unix operacinėse sistemose Python dažnai bus įdiegtas kartu su operacine sistema. Jei Python &lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_4.jpg&amp;diff=3775</id>
		<title>Vaizdas:Vadovelis 1Sk 4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_4.jpg&amp;diff=3775"/>
		<updated>2022-01-18T15:11:42Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instaliacijos baigimas&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3774</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=3774"/>
		<updated>2022-01-18T15:09:07Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3773</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=3773"/>
		<updated>2022-01-18T15:08:17Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
5. Palauk kol baigsis diegimas&lt;br /&gt;
6. Baigus diegimą pamtysi langą su pirmo paleidimo instrukcijomis&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 3.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_3.jpg&amp;diff=3772</id>
		<title>Vaizdas:Vadovelis 1Sk 3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_3.jpg&amp;diff=3772"/>
		<updated>2022-01-18T15:08:03Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instaliacijos baigimas&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3771</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=3771"/>
		<updated>2022-01-18T15:05:22Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Install'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3770</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=3770"/>
		<updated>2022-01-18T15:05:02Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3769</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=3769"/>
		<updated>2022-01-18T15:04:32Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|miniatiūra|Diegimo programos pirmas langas|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|frame|center]]&lt;br /&gt;
[[Vaizdas:D:\Pitonas\Diegiklis\1.jpg|frame|center]]&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3768</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=3768"/>
		<updated>2022-01-18T15:03:23Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|miniatiūra|Diegimo programos pirmas langas|frameless|center]]&lt;br /&gt;
&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|miniatiūra|frameless|Diegimo programos antras langas|kairėje]]&lt;br /&gt;
[[Vaizdas:D:\Pitonas\Diegiklis\1.jpg|frame|center]]&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3767</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=3767"/>
		<updated>2022-01-18T15:02:43Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|miniatiūra|Diegimo programos pirmas langas|frameless|kairėje]]&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|miniatiūra|frameless|Diegimo programos antras langas|kairėje]]&lt;br /&gt;
[[Vaizdas:D:\Pitonas\Diegiklis\1.jpg|frame|center]]&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3766</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=3766"/>
		<updated>2022-01-18T15:01:45Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|miniatiūra|Diegimo programos pirmas langas|frameless|kairėje]]&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|miniatiūra|Diegimo programos antras langas|frameless|kairėje]]&lt;br /&gt;
[[Vaizdas:D:\Pitonas\Diegiklis\1.jpg|frameless|kairėje]]&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3765</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=3765"/>
		<updated>2022-01-18T15:01:25Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|miniatiūra|Diegimo programos pirmas langas]]&lt;br /&gt;
4. Atsivers naujas langas, kuriame galima pasirinkti kokias dalis norima įdiegti. Rekomenduojama nieko nekeisti ir spausti mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 2.jpg|miniatiūra|Diegimo programos antras langas|frameless|kairėje]]&lt;br /&gt;
[[Vaizdas:D:\Pitonas\Diegiklis\1.jpg|frameless|kairėje]]&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_2.jpg&amp;diff=3764</id>
		<title>Vaizdas:Vadovelis 1Sk 2.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_2.jpg&amp;diff=3764"/>
		<updated>2022-01-18T15:00:34Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Diegimo programos antras langas&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3763</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=3763"/>
		<updated>2022-01-18T14:58:02Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:Vadovelis 1Sk 1.jpg|miniatiūra|Diegimo programos pirmas langas]]&lt;br /&gt;
4.&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_1.jpg&amp;diff=3762</id>
		<title>Vaizdas:Vadovelis 1Sk 1.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.angis.net/index.php?title=Vaizdas:Vadovelis_1Sk_1.jpg&amp;diff=3762"/>
		<updated>2022-01-18T14:57:29Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Pirmas diegimo programos langas&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3761</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=3761"/>
		<updated>2022-01-18T14:55:16Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&lt;br /&gt;
&lt;br /&gt;
=== Python ir Visual Studio Code diegimas ===&lt;br /&gt;
==== Naudojant LR NŠA Python ====&lt;br /&gt;
LR NŠA Python diegimo programa yra skirta Windows operacinės sistemos naudotojams.&lt;br /&gt;
1. Parsisiųsk diegimo programą iš https://www.visma.lt/python-diegimas/. Rekomeduojama rinktis 64 bitų versiją, nebent naudoji 32 bitų operacinės sistemą.&lt;br /&gt;
2. Paleisk parsisiųstą programą&lt;br /&gt;
3. Atsivers diegimo programos langas. Kad pradėtum diegimą spausk mygtuką '''Next'''.&lt;br /&gt;
[[Vaizdas:D:\Pitonas\Diegiklis\1.jpg|miniatiūra|Pirmas diegimo langas]]&lt;br /&gt;
4.&lt;br /&gt;
&lt;br /&gt;
Python ir Visual Studio Code teksto redaktorių gali įgiedti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3760</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=3760"/>
		<updated>2022-01-18T14:31:37Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&lt;br /&gt;
&lt;br /&gt;
Kad galėtum pradėti kurti Python programas tau reikės Python 3 programinės įrangos, bei kodo redaktoriaus. Rekomenduojame naudoti &amp;quot;LR NŠA Python&amp;quot; diegimo programą, kurią gali parsisiųsti iš https://www.visma.lt/python-diegimas/. Ši diegimo programa įdiegs Python interpretatorių, Visual Studio Code kodo redaktorių, bei sukonfiguruos tavo kompiuterį, kad galėtum iš karto rašyti ir vykdyti kodą.&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3759</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=3759"/>
		<updated>2022-01-18T14:14:47Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai, gali eiti toliau&lt;br /&gt;
&lt;br /&gt;
Tau taip pat vadovėluyje tave supažindinsiu su programavimo terminologiją. Tai ne tik tau padės suprasti ne tik apie ką kalba programuotojai, bet ir padės mokytis.&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3758</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=3758"/>
		<updated>2022-01-18T14:05:14Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Šis vadovėlis skirtas Python 3 versijai. Bandant kodo pavyzdžius vykdyti su Python 2.7 ir ankstesnėmis versijomis jis gali neveikti. Skirtumai tarp Python 2 ir 3 versijos nėra itin dideli, tad išmokęs Python 3 galėsi be didelių pastangų skaityti ir ankstenėms versijoms skirtą kodą.&lt;br /&gt;
&lt;br /&gt;
Pavyzdžiuose dažnai parodysiu programos vykdymo metu tavo įvedamą tekstą (jis bus '''paryškintas''') ir programos į ekraną išvedamą tekstą. Pavyzdžiui:&lt;br /&gt;
&lt;br /&gt;
 Stok!&lt;br /&gt;
 Kas eina? '''Benas'''&lt;br /&gt;
 Benai gali eiti&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3757</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=3757"/>
		<updated>2022-01-18T13:40:34Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Sveikas, pasauli!&lt;br /&gt;
&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3756</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=3756"/>
		<updated>2022-01-18T13:40:02Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Šitaip lengvai atskirsi kodo pavyzdžius nuo vadovėlio teksto. Jei skaitai internetinį knygos variantą, tai gali atkreipti dėmesį į kodo spalvą - ji kitokia tam kad išsiskirtų ir kad skirtingos kodo dalys galėtų būti &lt;br /&gt;
 atskiriamos nuo likusio kodo. Tau vedant kodą kompiuteriu kodo redagavimo programa jį gali nuspalvinti kitokiomis spalvomis arba iš viso nenuspalvinti. Kodo nuspalvinimas gali skirtis, bet tol kol įvesi kodą taip kaip nurodyta pavyzdžiuose jis veiks taip kaip ir aprašyta vadovėlyje.&lt;br /&gt;
&lt;br /&gt;
Vykdant anksčiau parašytą kodo pavyzdį kompiuteris ekrane išves tokį tekstą:&lt;br /&gt;
&lt;br /&gt;
 Hello, World!&lt;br /&gt;
&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
	<entry>
		<id>https://wiki.angis.net/index.php?title=Python_Vadov%C4%97lis/%C4%AEvadas&amp;diff=3755</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=3755"/>
		<updated>2022-01-18T13:25:58Z</updated>

		<summary type="html">&lt;p&gt;Martynas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{navigation |previous=Įžanga |next=Labas, Pasauli}}&lt;br /&gt;
&lt;br /&gt;
=== Įvadas ===&lt;br /&gt;
Šis vadovėlis skirtas visiems norintiems išmokti Python: tiek pirmą kartą bandantiems programuoti, tiek bandžiusiems programuoti kitomis programavimo kalbomis ir norintiems išmokti Python, tiek jau pramokusiems Python ir norintiems praplėsti žinias.&lt;br /&gt;
Yra vieintelis būdas išmokti programuoti. '''Tu''' turi skaityti ''kodą'' ir rašyti ''kodą''.&lt;br /&gt;
Vadovėlyje parodysiu tau daug kodo. Bandyk suvesti šį kodą ir išbandyti pats kaip jis veikia. Ekperimentuok ir bandyk daryti pakeitimus.&lt;br /&gt;
Nebijok, blogiausiu atveju tavo kodas tiesiog neveiks. Kai aš rašau kodą, jį suformatuoju šitaip:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Python kalbą lengva išmokti&lt;br /&gt;
print(&amp;quot;Sveikas, pasauli!&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=Įžanga |next=Labas, Pasauli}}&lt;/div&gt;</summary>
		<author><name>Martynas</name></author>
	</entry>
</feed>