0

Would you describe this code lines ?

Would you describe code lines of 4 and 5 from following code ? https://code.sololearn.com/c5z4ftxRU90w/?ref=app

15th Feb 2018, 11:20 PM
NIMA
NIMA - avatar
1 Odpowiedź
- 1
LINE 4: while x < len(sample_string): This is the start of the while loop that runs as long as x is less the length of input string. LINE 5: if sample_string[x].lower() not in 'aeiou' and sample_string[x].isalpha(): This is the conditional statement inside the while loop. It checks every character of input string in lowercase if it's not a vowel( not in 'aeiou') and if it's an alphabetic character(isalpha). If both conditions are true, it increments the counter by 1.
15th Feb 2018, 11:40 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar