Q50.Let `X` be a row in the Words dataset. Procedure `isRich(X)` should return `True` if the number of distinct vowels is less than the number of distinct consonants in `X.Word`. The code may have mistakes. Identify all such mistakes, if any.
```
Procedure isRich(X)
vDict = {}, wDict = {}
i = 1
while(i <= X.LetterCount) {
A = ith letter in X.Word
if(A is a vowel) {
vDict[A] = True
}
wDict[A] = True
i = i + 1
}
if(length(keys(vDict)) < length(keys(wDict))) {
return(True)
}
return(True)
End isRich
```
Save
Check
Details
Q50
2 Apr 2023
Q50.Let `X` be a row in the Words dataset. Procedure `isRich(X)` should return `True` if the number of distinct vowels is less than the number of distinct consonants in `X.Word`. The code may have mistakes. Identify all such mistakes, if any.
```
Procedure isRich(X)
vDict = {}, wDict = {}
i = 1
while(i <= X.LetterCount) {
A = ith letter in X.Word
if(A is a vowel) {
vDict[A] = True
}
wDict[A] = True
i = i + 1
}
if(length(keys(vDict)) < length(keys(wDict))) {
return(True)
}
return(True)
End isRich
```