173 lines
5.1 KiB
HTML
173 lines
5.1 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
|
<title>Uvod u programiranje - 4. čas</title>
|
|
|
|
<link rel="stylesheet" href="dist/reset.css">
|
|
<link rel="stylesheet" href="dist/reveal.css">
|
|
<link rel="stylesheet" href="dist/theme/black.css">
|
|
|
|
<!-- Theme used for syntax hPighlighted code -->
|
|
<link rel="stylesheet" href="plugin/highlight/monokai.css">
|
|
</head>
|
|
<body>
|
|
<div class="reveal">
|
|
<div class="slides">
|
|
<section>
|
|
<p>Uvod u programiranje</p>
|
|
<p>4. čas</p>
|
|
</section>
|
|
<section>
|
|
Da ponovimo<br/><br/>
|
|
<ul>
|
|
<li class="fragment">Domaći / pitanja</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
Uvod u liste<br/>
|
|
<ul>
|
|
<li class="fragment">Kreiranje liste</li>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
lista = list()
|
|
druga_lista = []
|
|
</code>
|
|
</pre>
|
|
<li class="fragment">ili sa početnim vrednostima:</li>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
predmeti = ['srpski', 'matematika', 'istorija']
|
|
ocene = [5, 4, 4]
|
|
</code>
|
|
</pre>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
Indeksiranje liste<br/>
|
|
<ul>
|
|
<li class="fragment">Brojevima, ali prvi element je nula!</li>
|
|
<pre class="fragment" style="font-size: 0.75em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
predmeti = ['srp', 'mat', 'ist', 'geo', 'fiz', 'hem']
|
|
0 1 2, 3 4 5
|
|
ocene = [5, 4, 4, 1, 2, 3]
|
|
0 1 2 3 4 5
|
|
</code>
|
|
</pre>
|
|
<li class="fragment">dodeljivanje promenljivih i ispis:</li>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
prvi_predmet = predmeti[0]
|
|
print('poslednji predmet: ', predmeti[-1])
|
|
</code>
|
|
</pre>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
Veličina liste<br/>
|
|
<ul>
|
|
<li class="fragment">Funkcija len()</li>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
print('broj predmeta', len(predmeti))
|
|
</code>
|
|
</pre>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
Dodavanje i brisanje elemenata<br/>
|
|
<ul>
|
|
<li class="fragment">Funkcija append</li>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
predmeti.append('muz')
|
|
ocene.append(5)
|
|
</code>
|
|
</pre>
|
|
<li class="fragment">Funkcija remove</li>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
predmeti.remove('muz')
|
|
ocene.remove(5)
|
|
</code>
|
|
</pre>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
Provera postojanja elementa u listi<br/>
|
|
<ul>
|
|
<li class="fragment">Rezervisana reč "in"</li>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
ima_mat = 'mat' in predmeti
|
|
</code>
|
|
</pre>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
if 'srpski' in predmeti:
|
|
print('ima srpskog')
|
|
</code>
|
|
</pre>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
Spajanje listi<br/>
|
|
<ul>
|
|
<li class="fragment">Sa plus (+)</li>
|
|
<pre class="fragment" style="font-size: 0.85em;;width: 100%">
|
|
<code data-trim data-noescape>
|
|
predmeti = predmeti + ['lik', 'eng']
|
|
nove_ocene = [5, 5]
|
|
ocene = ocene + nove_ocene
|
|
</code>
|
|
</pre>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
Domaći<br/>
|
|
<ul>
|
|
<li class="fragment">
|
|
Pitati korisnika da unese broj predmeta i pitati ga u while petlji da unese sve predmete i popuniti listu
|
|
</li>
|
|
<li class="fragment">
|
|
Ispitati šta se dešava ako se lista isprinta (npr. print([1, 2, 3])
|
|
</li>
|
|
<li class="fragment">
|
|
Napravit program za detekciju cenzure. Na početku korisnik unosi neki tekst i 3 cenzurisane reči i program ispiše da li tekst treba cenzurisati.
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
Domaći<br/>
|
|
<ul>
|
|
<li class="fragment">
|
|
Koristeći listu sa poklonima, napraviti program koji izvlači poklone iz liste i prikazuje ih
|
|
(savet: indeks u listi može biti random.randint(0, 4)
|
|
</li>
|
|
<li class="fragment">
|
|
Na <a href="zadatak4.html">ovom linku</a> je 10 DNK sekvenci. Naći koja sekvenca sadrži gen "ATTTCGGC"
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="dist/reveal.js"></script>
|
|
<script src="plugin/highlight/highlight.js"></script>
|
|
<script>
|
|
// More info about initialization & config:
|
|
// - https://revealjs.com/initialization/
|
|
// - https://revealjs.com/config/
|
|
Reveal.initialize({
|
|
hash: true,
|
|
|
|
// Learn about plugins: https://revealjs.com/plugins/
|
|
plugins: [ RevealHighlight ]
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|