Hello
Im having difficulties with my assignment...,i have to do the following:
A valid phone number is:
- One that has 10 or 11 digits.
- One that if it contains 11 digits is a long distance phone number and must start with the digit 1.
- One that if it contains 10 digits then it is a local phone number and therefore cannot start with the digit 0 or 1. - A phone number which contains only digits.
1. If the length of the phone number is neither 10 nor 11
Display an appropriate error message and end program
Else
If the phone number is of length 10 but begins with 0 or 1
Display an appropriate error message and end program
Else
if the phone number is of length 11 but does NOT begin with 1
Display an appropriate error message and end program
Else If the phone number contains any non-digit characters
Display an appropriate error message and end program
So with some struggle i made my way through all of those conditions
except the last one... The only function for finding things we ve learned so
far is .find() , but it seems stupid trying to fit it the whole alphabet
into it...
So can anyone suggest something? But not too fancy, since it should be solvable
with some of the basic functions...
Thanks you all...
ok i just did it the way you said, it works fine, thank you! but the new problem is that now it gives me not only the error that i need but also gives me a formated number with char's...:/
How do i output only the error?