I'm new to python and I'm trying to count punctuation in a string input by user, and I"ve been able to do it w/ out a loop, but would like to emply a more efficiant method.
I've been able to loop through and grabb the characters, but they are'nt being displayed as a single value which is what I need so I can add this snipit to a larger piece of code.
here is my code:
str1 = input("Please enter a sentence: ")
for i in ["!","."]:
g = str1.count(i)