Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #1sza funkcja, która działa
  2. def song_decoder(song):
  3. temp=[]
  4. for w in song.split("WUB"):
  5. if w!="":
  6. temp.append(w)
  7. return " ".join(word[::] for word in temp)
  8. #2 fkcja, nie działa ale bardziej zwięzła i czemu nie działa?
  9. def song_decoder(song):
  10. temp=[]
  11. return " ".join(word[::] for word in (temp.append(w) if w!="" else 0 for w in song.split("WUB")))
  12.  
  13.  
  14. song="AWUBWUBWUBBWUBWUBWUBC"
  15. print(song_decoder(song))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement