1!/usr/bin/python2 #Encoding:utf-83 #This is a small script to detect whether the user entered the mobile phone number is legitimate. 4 5 defPhonecheck (s):6 #prefix, if the operator enables a new segment, simply add the new number segment to this list. 7phoneprefix=[' the','131',' the','133','134','135','136','137','138','139',' Max','151',' the','153','156','158','159',' the','183','182','185','186','188','189']8 #Check if the length of the number is legal. 9 ifLen (s) <>11:Ten Print "The length of Phonenum is one by one." One Else: A #detects whether the numbers entered are all numbers. - ifs.isdigit (): - #detects if the prefix is correct. the ifS[:3]inchPhoneprefix: - Print "The phone num is valid." - Else: - Print "The phone num is invalid." + Else: - Print "The phone num is made up of digits." + A at if __name__=="__main__": -Phonenum=raw_input ("Input your phone num:") -Phonecheck (Phonenum)