# 条件判断 也叫流程分支。
# print('step1')
#
# if 3 > 1: # 选配
# print('step2')
#
# print('over')
# score = int(input('请输入你的分数')) # input输入的永远都是str
#
# if score >= 80:
# print('A')
# elif score >=60:
# print('B')
# else:
# print('C')
# if嵌套
# if score >= 60:
# print('及格')
# if score >= 70:
# if score >= 80:
#
# if score >= 90:
# print('')
# else:
# print('D')
"""
需求:判断用户输入的手机号是否有效,输出对应的运营商。
暂定义为138开头的为移动,其他的为联通
"""
x = input('请输入手机号:')
if len(x) == 11:
if x.isdigit(): # 该方法可以用来判断用户输入的是否全数字。 .isspace()这个方法是用来判断是否全是空格。
if int(x[0:3]) == 138: # 包头不包尾
print('移动')
else:
print('联通')
else:
print('输入非法字符')
# try: --等后面学习再考虑用try
# int(x)
# if x[0:2] == 138:
# print('移动')
# except Exception as erro:
# print('输入非法字符')
else:
print('输入错误的长度')
# 0或者空都为false,如果非0非空则为true