t ask the user for input and when they type letters it comes up with an error message (as i want) but even when user enters number it comes up with error. I want it to come out of this loop and on to next for name if correct data is inputed.
            Asked
            
        
        
            Active
            
        
            Viewed 75 times
        
    0
            
            
        - 
                    1Read the [input() docs](https://docs.python.org/3/library/functions.html#input). That function always returns a string, not an integer. – skrrgwasme Jan 19 '16 at 19:56
2 Answers
5
            
            
        input always returns text - even there are only digits.
Use int(Telephone) to convert to integer or Telephone.isdigit() to check if there are only digits in text.
BTW: both methods are useless if user use spaces or - in phone number ;)   
Maybe you will have to remove spaces and - using replace() before you use int() or isdigit()
 
    
    
        furas
        
- 134,197
- 12
- 106
- 148
- 
                    OP, check out [`int()`](https://docs.python.org/2/library/functions.html#int). – Sam Jan 19 '16 at 19:57
3
            
            
        You need to convert to an int:
while True:
    try:
        Telephone = int(input("Please enter your telephone number "))
        break
    except ValueError:
        print ("Sorry, system does not recognise input ")
 
    
    
        AChampion
        
- 29,683
- 4
- 59
- 75
- 
                    1
- 
                    Even using this code and changing catch to except it runs and every time it runs the question just keeps repeating when it should move to next loop – Programmer Jan 19 '16 at 20:11
- 
                    
- 
                    
