Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d87c9c3

Browse files
committed
Time: 3 ms (18.53%) | Memory: 17.8 MB (34.46%) - LeetSync
1 parent bcce7f6 commit d87c9c3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎3396-valid-word/valid-word.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution:
2+
def isValid(self, word: str) -> bool:
3+
minim = len(word) >=3
4+
vowel = 0
5+
6+
consonant = 0
7+
for st in word:
8+
if not ( st.isalpha() or st.isdigit()):
9+
return False
10+
if st.isalpha() and st.lower() in {"a", "i", "e", "o", "u"}:
11+
vowel +=1
12+
if st.isalpha() and st.lower() not in {"a", "i", "e", "o", "u"}:
13+
consonant +=1
14+
15+
print(vowel)
16+
print(consonant)
17+
return vowel >=1 and consonant >=1 and minim

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /