Advertisement
Guest User

kirundi.py

a guest
Oct 23rd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. ######################################################################################################################################
  2. # #
  3. #
  4. # Man aha hari aka array nagize nkoresheje aka algo ka c++ mukwandika muri file ama variable muri array # ya python gusa ntibikunda ko ndagashirako ako ka array kuko gapima konyene 6MB
  5. #
  6. # #
  7. ######################################################################################################################################
  8. def iskirundi(word):
  9. if word.lower().startswith('ku') or word.lower().startswith('gu') or word.lower().startswith('kw'):
  10. return True
  11. elif word.lower() in kir:
  12. return True
  13. else:
  14. return False
  15. def percentage_of_kirundi(txt):
  16. count=0
  17. possible_words=txt.lower().split(' ')
  18. for word in possible_words:
  19. if iskirundi(word):
  20. count+=1
  21. else:
  22. kir.append(word)
  23. return "tugerageje kuraba tugakoresha ubumenyi iyi machini ifise iryo jambo ni ikirudi ku bice "+str((count*100)/len(possible_words))+" kw'ijana"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement