pyt5a.py 642 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # this programme compare a text in french and its translation in englishe and liste the common words .
  4. textFr ="j'ai fait le sport : le jogging"
  5. textEn = "I do sport : jogging "
  6. mots=textFr.split()
  7. words=textEn.split()
  8. # for each word in the line:
  9. #for mot in mots:
  10. # print the "mot"
  11. #print(mot)
  12. #for word in words:
  13. # print the "word"
  14. #print(word)
  15. nb=0
  16. for word in words:
  17. word = word.strip(" ;''?:,()!.\").”-")
  18. for mot in mots:
  19. #mot = mot.strip(" ;''?:,()!.\").”-")
  20. if word == mot :
  21. nb= nb+1
  22. print(word)
  23. print("nombres des mots identiques =" , nb)