This is my first coding class and I'm a little confused...
Im looking to write a program that prompts for a phone number and determines whether or not it's a valid 10-digit number by ignoring any punctuation. I have to write a function that takes the phone number string as a parameter and returns True if it is valid, and False if not. I also have to use a loop to iterate over the string and increment counter whenever I see a digit.
I'm not sure this is correct , but this is what I came with so far. I'm not sure how to create a loop to iterate over a string to determine True or False phone numbers.
main():
phone_number= input("Please enter a phone number in the format XXX-XXX-XXXX: ")
validNumber(phone_number)
def validNumber(phone_number):
for i,c in enumerate(phone_number):
if i in [3,7]:
if c!= "-":
phone_number=input("Please inter a valid phone number:")
return False
elif