Professional Documents
Culture Documents
1. HTML
2. HTTP
3. FTP
4. SMTP
Za prebacivanje fajlova sa PC-a na server, služi nam
koji protokol?
1. HTML
2. HTTP
3. FTP
4. SMTP
5. RTP
6. WTF
TCP/IP je:
1. Web protokol
2. Transmission control protocol/internet
protocol
3. Program koji preuzima zahtjeve i šalje
odgovore
4. Funkcija u pythonu
5. Keks?
Pravilan python tag je :
1. ?py;
2. <py>
3. </Py>
4. #PY
5. Python nema tagove
Odaberite validne nazive varijabli
1. A = „5‘
2. B = „Atif“
3. C = Atif
4. D = ‚Atif“
5. E = <-9555
Koja ekstenzija aktivira python interpreter
• .python
• .pyp
• .pyextension
• .py
Koja funkcija daje informaciju o Python verziji?
• Python(version)
• Python –version
• Python –-version
• Pythonv():
Ispraviti greške u kodu :
• x = „atif‘
y = 23
print(„Skolujem se na IT akademiji)
print(„zovem se“ + x)
Imam (y godina)
Python Booleans
Uvod u programiranje drugi dio
Booleans
print(10 > 9)
print(10 == 9)
print(10 < 9)
Booleans
Print(bool(„Hello“))
print(bool(15))
Booleans
• X = „hello“
y = 15
print(bool(x))
print(bool(y))
Booleans
Bool(„abc“)
Bool(123)
• Bool([„apple“, „cherry“, „banana“])
Booleans
Bool(False)
bool(None)
bool(0)
bool(„“)
• Bool(())
bool([])
bool({})
Booleans challange
• Print(10>9)
• Print(10<9)
• Print(10<19)
• Print(10>3)
• Print(10+5)
Python Booleans
Uvod u programiranje drugi dio
Python operatori
1. Arithmetic operators
2. Assignment operators
3. Comparison operators
4. Logical operators
5. Identity operators
6. Membership operators
7. Bitwise operators
Python artimetički operatori
x=5
y=3
print(x+y)
• x = 15
y=2
print(x//y)
Python assignment operatori
• X=5
X+=3
X-=3
X*=3
• X=5
Y=3
print(X==Y)
• X=5
Y=3
print(X != Y)
Python logical operatori
• X=5
print(X > 3 and x < 10)
• X=5
print(not(x > 3 and x < 10))
Python identity operatori
• X = [„apple“, „banana“]
• Y = [„apple“, „banana“]
z=x
• Print(x is z)
• Print(x is y)
• Print(x == y)
Python membership operatori
• x = ["apple", "banana"]
• print("banana" in x)
Python bitwise operatori
•
Webchallange #1
LIST :
list1.extend(list2)
print(list1)
Python collections ( arrays ) - LISTS
• Na slici mozemo vidjeti sve pobrojane metode koje možemo
koristiti u Python-u ( kada je riječ o listama ) :
Webchallange #2
• Definisati listu fruits sa vrijednostima banana, jabuka,
narandza. Prvobitno provjeriti da li se sve tri vrijednosti nalaze
u listi koristeći IN keyword, zatim provjeriti dužinu liste te
putem indeksiranja prikazati [1] član liste.
• thistuple =
("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[-4:-1])
Python collections ( arrays ) - TUPLES
• Buduci da smo rekli da je TUPLE nepromjenjiv, to znači da ne možemo
mjenjati vrijednosti njegovih članova kao što smo mogli u listama. Da bi
promjenili vrijednosti u tuple-u moramo ga konvertovati u listu, zatim
promjeniti vrijednost, te ga vratiti u prvobitni data-type, tj tuple.
print(x)
Python collections ( arrays ) - TUPLES
• Da bi provjerili da li se apple nalazi u tuple-u koristimo in keyword :
• thistuple = ("apple",)
print(type(thistuple))
#NOT a tuple
thistuple = ("apple")
print(type(thistuple))
Python collections ( arrays ) - TUPLES
• Ne možemo dodati vrijednost u tuple, budući da je ovaj
data-type nepromjenjiv.
print("banana" in thisset)
print(len(thisset))
thisset.remove("banana")
print(thisset)
Python collections ( arrays ) - SETS
• thisset = {"apple", "banana", "cherry"}
x = thisset.pop()
print(x)
print(thisset)
auto = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(auto)
Python collections ( arrays ) - DICTIONARIES
• Budući da su dictionaries indexable, možemo pristupiti članovima :
x = thisdict["model"]
• x = thisdict.get("model")
Python collections ( arrays ) - DICTIONARIES
• Možemo mjenjati vrijednost svim članovima navedenog data-type-a.
auto = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
auto["year"] = 2018
Python collections ( arrays ) - DICTIONARIES
• Da provjerimo da li se neki od „ključeva“ nalazi u dictionary-u, koristimo
in keyword
auto = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
if "model" in auto:
print("Yes, 'model' is one of the keys in the auto dictionary")
auto = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
auto["color"] = "red"
print(auto)
Python collections ( arrays ) - DICTIONARIES
• Da bi uklonili neki od članova koristimo pop() metodu.
auto = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
auto.pop("model")
print(auto)
Python collections ( arrays ) - DICTIONARIES
• Del keyword briše jedan od članova sa specifično definisanim
ključem(key)
auto = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
del auto["model"]
print(thisdict)
Python collections ( arrays ) - DICTIONARIES
• thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
del thisdict
Python collections ( arrays ) - DICTIONARIES
• thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict.clear()
print(thisdict)
Python collections ( arrays ) - DICTIONARIES
• Kopiranje direktorija vršimo putem copy() metode.
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict1 = thisdict2
print(thisdict2)
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
mydict = thisdict.copy()
print(mydict)
Python collections ( arrays ) – NESTED
DICTIONARIES
• myfamily = {
"child1" : {
"name" : "Emil",
"year" : 2004
},
"child2" : {
"name" : "Tobias",
"year" : 2007
},
"child3" : {
"name" : "Linus",
"year" : 2011
}
}
Python collections ( arrays ) – NESTED
DICTIONARIES
• child1 = {
"name" : "Emil",
"year" : 2004
}
child2 = {
"name" : "Tobias",
"year" : 2007
}
child3 = {
"name" : "Linus",
"year" : 2011
}
myfamily = {
"child1" : child1,
"child2" : child2,
"child3" : child3
}
Python collections ( arrays ) – DICTIONARY
METHODS
Dictionary Challange #5