Where I am wrong? The task is to find the average word length... can you fix my code plz? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

Where I am wrong? The task is to find the average word length... can you fix my code plz?

Takes in a string, figure out the average length of all the words and return a number representing the average length. Remove all punctuation. Round up to the nearest whole number. Input Format: A string containing multiple words. Output Format: A number representing the average length of each word, rounded up to the nearest whole number. Sample Input: this phrase has multiple words Sample Output: 6 https://code.sololearn.com/ck875H4iRCt0/?ref=app

12th Oct 2021, 6:05 PM
RLB
RLB - avatar
3 Respuestas
+ 3
RLB , the conditional should include the letters a, A and also z, Z: if(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')
12th Oct 2021, 6:33 PM
Lothar
Lothar - avatar
+ 3
Yeah you are right guys, I fixed it already but thank you anyway !!!!
12th Oct 2021, 6:34 PM
RLB
RLB - avatar
+ 2
Only thing what I see: What about this? c>='a' && c<='z' || c>='A' && c<='Z') Added some '='
12th Oct 2021, 6:32 PM
Coding Cat
Coding Cat - avatar