SHARE
TWEET

Untitled

a guest Dec 8th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def pravilno_napisane_zagrade(string):
  2.     lista = []
  3.     for i in string:
  4.         if i == '(':
  5.             lista.append(i)
  6.         elif i == ')':
  7.             if len(lista) > 0:
  8.                 lista.pop()
  9.             else:
  10.                 return False
  11.     if len(lista) == 0:
  12.         return True
  13.     return False
  14. string = str(input("Unesite primer za proveru zagrada:"))
  15. if len(string) == 0:
  16.     print("Niste uneli primer za proveru zagrada")
  17.     exit(1)
  18. if pravilno_napisane_zagrade(string):
  19.     print("Zagrade su pravilno napisane")
  20. else:
  21.     print("Zagrade nisu pravilno napisane")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top