Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. while True:
  2. cap = input()
  3. if cap == "":
  4. break
  5. capList = cap.split() #The method split() returns a list of all the words in the string, using str as the separator
  6. mistake = 0
  7. i = 0
  8. accepted = ["c","k","s","v","y","e","o","t","w","z","f","p","u","x","I","l"]
  9. while i<len(capList[0]):
  10. if capList[0][i] != capList[1][i]:
  11. mistake += 1
  12. if capList[1][i].lower() in accepted:
  13. if capList[0][i].lower() == capList[1][i].lower():
  14. mistake-=1
  15. if capList[1][i] == "l" and capList[0][i] == "I" or capList[1][i] == "I" and capList[0][i] == "l":
  16. mistake-=1
  17. i+=1
  18. if mistake:
  19. if len(capList[1]) > 5 and mistake < 2:
  20. print("Right " + str(mistake))
  21. if len(capList[1]) > 5 and mistake >= 2:
  22. print("WRONG " + str(mistake))
  23. if len(capList[1]) <= 5:
  24. print("WRONG " + str(mistake))
  25. if not mistake:
  26. print("Right " + str(mistake))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement