daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 53 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. zdanie = "((p^q)=>((pvq)^((t^q)v(z^y))"
  2.  
  3. def SzukanieNawiasow(i):
  4.     fragment = ""
  5.     i+=1
  6.     while i<len(zdanie) and zdanie[i]!= ')':
  7.         if zdanie[i] == '(':
  8.             i= i+ len(SzukanieNawiasow(i)) +2
  9.         fragment+=zdanie[i];
  10.         i=i+1
  11.     print(zmianaKolejnosci(fragment))
  12.     return fragment
  13.  
  14.  
  15. def zmianaKolejnosci(fragm):
  16.     dlugosc = len(fragm)
  17.     k = 0
  18.     lewa = ""
  19.     srodek = ""
  20.     prawa = ""
  21.     i = 0
  22.     while fragm[i] != "v" and fragm[i] != "^" and fragm[i] != "<" and fragm[i] != "=":
  23.         lewa += fragm[i]
  24.         i += 1
  25.     k = i + 1
  26.     srodek = fragm[k - 1]
  27.     while k < dlugosc:
  28.         prawa += fragm[k]
  29.         k += 1
  30.     fragm = srodek + lewa + prawa
  31.     return fragm
  32.  
  33.  
  34. SzukanieNawiasow(0)
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
 
Top