Advertisement
lp-gamboa

a ver elfa :v

Mar 3rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. def fbf(str):
  2.     resp = True
  3.     n = 0
  4.     for x in str:
  5.         if x==")":
  6.             if n == 0: resp = False
  7.             n-=1
  8.         elif x=="(":
  9.             n+=1
  10.            
  11. noVale = ")("
  12. print fbf(noVale) #acรก lo estas llamando, puedes guardar ese valor en una variable para hacer un print mรกs bonito si quieres
  13. vale = "(a^2) + b^2"
  14. print fbf(vale) #Lo mismo acรก
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement