標籤:class code pytho 供應商 color sea python opera blog
1 def Seach_Phone_Nmuber_operator(): 2 CN_mobile = [134,135,136,137,138,139,150,151,152,157,158,159,182,183,184,187,188,147,178,1705] 3 CN_union = [130,131,132,155,156,185,186,145,176,1709] 4 CN_telecom = [133,153,180,181,189,177,1700] 5 6 phone_nmu = input(‘請輸入要查詢的手機號:‘) 7 qc_rd = phone_nmu[0:3] 8 if len(phone_nmu) == 11: 9 if phone_nmu.isdigit():10 if int(qc_rd) in CN_mobile:11 print("您輸入的手機號是:",phone_nmu)12 print("供應商:中國移動 \n")13 elif int(qc_rd) in CN_union:14 print("您輸入的手機號是:", phone_nmu)15 print("供應商:中國聯通 \n" )16 elif int(qc_rd) in CN_telecom:17 print("您輸入的手機號是:", phone_nmu)18 print("供應商:中國電信\n")19 else:20 print("您輸入的手機號號段不正確,請重新輸入 \n")21 else:22 print("無效的手機號,輸入的手機號必須是11位元字 \n")23 else:24 print("無效的手機號,請輸入11位元字的手機號 \n")25 i = 126 while i > 0:27 Seach_Phone_Nmuber_operator()28 Seach_Phone_Nmuber_operator()
Python_查詢手機供應商