SHOW:
|
|
- or go back to the newest paste.
1 | function validateAnswer(answer, randomLetters[]) | |
2 | - | |
2 | + | if answer.length > 10: |
3 | print("0") ### Checks to see if the answer is within the valid size (10) | |
4 | else: | |
5 | for i in range(answer.length()): | |
6 | if randomLetters[0] is in answer: | |
7 | randomLetters.remove[0] ### Checks if the letters in the answer are in the given 10 letters | |
8 | else: ### Also returns "0" if there are repeated letters as the originals are removed if used | |
9 | print("0") | |
10 | if randomLetters.length() == 0: | |
11 | print(answer.length()) | |
12 | endFunction |