+ 1

why is it showing indentation error??

x=input("Enter a string") chars=0 capitals=0 vowels=0 digits=0 consonants=0 for i in range(len(x)): chr+=1 if x[i].isupper(): capitals+=1 elif x[i] in "aeiouAEIOU": vowels+=1 elif x[i].isdigit(): digits+=1 elif x[i].isaplha(): consonants+=1 print("Total number of characters:",chars ) print("Total number of capital letters:",capitals ) print("Total number of vowels :",vowels ) print("Total number of digits:",digits ) print("Total number of consonance:",consonance )

8th Feb 2024, 3:16 PM
LetIancook
LetIancook - avatar
3 Antworten
+ 9
LetIancook , > besides the indentation issue, there are also several 'typos / spelling` problems in the code (variable names, function names, ...). > try to run the code and read the error messages carefully. try to debug the code step by step and correct all issues.
8th Feb 2024, 4:21 PM
Lothar
Lothar - avatar
+ 5
LINK your code instead of pasting it into the description. This way, people can actually test it. chr += 1 is not aligned
8th Feb 2024, 3:18 PM
Lisa
Lisa - avatar
0
okk
8th Feb 2024, 3:22 PM
LetIancook
LetIancook - avatar