I am writing a program that allows a user to input a string and the program will count the number of characters only (no spaces and punctuation). For waht I have used I ma trying to use a for loop that goes through all the characters of the string and will increment the count value if the value is not a psace or punctuation. Howeevre it s not working and its giving me an error that my string input is an integer even though python will autromatically convert to string
What I have tried is to use the toString method but that didnt work for some reason. For example if I were to input "Hello World!" to the program it will print out "Length is 10"
this is my code here
input = input("enter a string: ")
count = 0
for i in len(input):
if (input(i) == "," or input(i) == " " or input(i) == "!" or input(i) == "."):
i += 1
else:
count += 1
print("Length is: " + count + " characters")