Advertisement
MoniaJ

KdK_get_sandwich

Oct 15th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. def get_sandwich(text):
  2.     if "chleb" in text:
  3.         a = True
  4.     else:
  5.         a = False
  6.     if a == True:
  7.         gdzie_chleb = text.find('chleb')
  8.         text2 = text[gdzie_chleb+5:]
  9.         gdzie_drugi_chleb = text2.find('chleb')
  10.         if gdzie_drugi_chleb == -1:
  11.             print('')
  12.         else:
  13.             print(text[(gdzie_chleb+5):(gdzie_chleb+5+gdzie_drugi_chleb)])
  14.     else:
  15.         print('brak sΕ‚owa chleb')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement