Last active
April 5, 2016 09:15
-
-
Save MicicFilip/f62a9a3e5ae0234770bfd0892ba00f9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def first(niz = []): | |
return niz.pop(0) | |
def last(niz = []): | |
return niz.pop(-1) | |
def tail(niz = []): | |
niz.pop(0) | |
return niz | |
def init(niz = []): | |
niz.pop(-1) | |
return niz | |
niz = [1, 2, 3, 4, 5, 6] | |
print (init(niz)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prvi(a, b, op): | |
return{ | |
'+' : a + b, | |
'-' : a - b, | |
'*' : a * b | |
}.get(op, a + b) | |
rez = prvi(1 , 2, '+') | |
rez1 = prvi(2, 3, '-') | |
rez2 = prvi(4, 5, '*') | |
print(rez) | |
print(rez1) | |
print(rez2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment