Skip to content

Instantly share code, notes, and snippets.

@MicicFilip
Last active April 5, 2016 09:15
Show Gist options
  • Save MicicFilip/f62a9a3e5ae0234770bfd0892ba00f9b to your computer and use it in GitHub Desktop.
Save MicicFilip/f62a9a3e5ae0234770bfd0892ba00f9b to your computer and use it in GitHub Desktop.
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))
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