Python从入门到高手(内部资源-配学习资料)

# # isalpha()判断是否是字母  isdigit()判断是否是数字
# s = 'abcd6'
# result = s.isalpha()
# print('result=', result)
#
# s = '6688'
# result = s.isdigit()
# print('result=', result)
#
# sum = 0
# for i in range(3):
#     num = input('请输入数字:')
#     if num.isdigit():
#         num = int(num)
#         sum += num
#
# print('sum', sum)

# sum = 0
# i = 1
# while i <= 3:
#     num = input('请输入数字:')
#     if num.isdigit():
#         num = int(num)
#         sum += num
#         i += 1
#         print('第{}个数字累加成功!'.format(i - 1))
#     else:
#         print('不是数字!')
# print('结果是{}'.format(sum))