# 字符串常用属性和操作
# a = 'aa'
# b = 'bb'
# c = 'cc'
# d = a + b + c
# print(d) # age = 50
# print('田老师的年龄是' + str(age) + '岁') # e = '&'.join([a, b, c])
# print(e)
# print('###'.join([a, b, c]))
# print(' '.join([a, b, c]))
# print(''.join([a, b, c])) # 分隔符写一个空字符串
#
# a = "您账户{account}于{month}月{day}日入账工资,人民币{money},{ad}"
# account = '4567'
# money = '800.45'
# ad = 'xx理财'
# month = 10
# day = 15
# a = a.format(account=account,
# money=money,
# ad=ad,
# month=month,
# day=day)
# print(a)
#
# str01 = 'welcome to huice'
# a = str01.replace('e', '$', 2)
# print(a)
# print(str01.find('lc', 2, 13))
# print(str01.find('ll'))
# print(str01.index('l'))
# # print(str01.index('ll'))
#
# a = 'a&b&c'
# print(a.split('&'))
#
# a = ' Welcome To Huice '
# print(a.upper())
# print(a.lower())
# print(a.capitalize())
# print(a.isupper())
# print(a.islower())
# print(a.istitle())
#
# print(a.strip())
# print(a.lstrip())
# print(a.rstrip())
#
# # alpha
# print(a.isalnum())
# print(a.isalpha())
# print(a.isspace())
# print(a.startswith(' '))
# print(a.endswith(' '))
# print(a.count('l', 0, 13)) # 输出与输入
# print('a', 'b', 'c') # 默认以空格分隔
# st = open('./1.txt', 'w')
# print('hi', 'wel', 'com', sep=' & ', end=' ')
# print('hi', 'wel', 'com', sep=' & ', end='', file=st) # a = input('请输入一个数字:') # input会把任何输入当做字符串处理
# print(int(a) + 1) # 控制语句
# a = input('请输入字符串')
# if a.isdigit():
# print('是纯数字')
# else:
# print('不是纯数字') # a = input('请输入一个数字:')
# if a.isdigit():
# b = int(a)
# c = b % 3
# if c == 0:
# print('能被3整除')
# else:
# print('不能被3整除')
# else:
# print('输入有误') # a = input('请输入一个字符串:')
# if a.isdigit() or a.startswith('-') and a[1:].isdigit():
# b = int(a)
# if b > 0:
# if b % 3 == 0 and b % 7 == 0:
# print('可以同时被3和7整除')
# else:
# print('不可以同时被3和7整除')
# else:
# print('请输入正数。')
# else:
# print('输入的不是数字!') # flag = 2
# while flag > 0:
# # flag = flag - 1
# a = input('请输入月份:')
# if a == 'exit':
# break
# if a.isdigit():
# a = int(a)
# if a in [1, 3, 5, 7, 8, 10, 12]:
# print('%d月有31天' % a)
# elif a in [4, 6, 9, 11]:
# print('%d月有30天' % a)
# elif a == 2:
# print('28天')
# else:
# print('月份不正确!')
# else:
# print('请输入数字') # a = [1, 2, 3, 4]
# for i in a:
# print(i)
# print('*') #
# for c in 'Hello Huice':
# print(c, end=(' '))
#
# for i in [1, 5, 2, 7, 9]:
# print(i ** 2, end=' ') # str = 'huice'
# for i in str:
# print(ord(i), end=' ') # a = input('请输入一行字符:')
# count_alpha = count_space = count_digit = count_other = 0
# for char in a:
# if char.isalpha():
# count_alpha += 1
# elif char.isdigit():
# count_digit += 1
# elif char.isspace():
# count_space += 1
# else:
# count_other += 1
# result = '''字母有{zm}个,
# 空格有{kg}个,
# 数字有{sz}个,
# 其他字符有{qt}个'''
# result = result.format(zm=count_alpha, kg=count_space, sz=count_space, qt=count_other)
# print(result) # print(range(1, 10))
# print(type(range(1, 10))) # for i in range(1, 10, 2): # 前包含,后不包含
# print(i, end=' ') # lst0 = ['两', '个', '黄', '鹂']
# # for i in range(0, len(lst0), 2):
# # for i in range(len(lst0)-1, -1, -1):
# for i in range(len(lst0)): # 相当于range(0,len(lst0,1))
# print(lst0[i], end='') # for i in range(1, 101):
# if i % 2 == 0:
# print(i, end=' ') # i = 0
# while i < 101:
# i += 1
# if i % 2 == 0:
# print(i, end=' ') # import time # 时间模块
# signs = ['/', '-', '\\', '|']
# while True:
# for c in signs:
# print(c, '\r', end='')
# time.sleep(0.1) # 等待0.1s # for i, c in enumerate('huice'):
# print(i, c) # rank = ['OPPO', 'vivo', 'Apple', 'Huawei', 'HONOR', 'MI', 'MEIZU']
# for i, brand in enumerate(rank):
# print('第%d名是%s' % (i + 1, brand)) # for i in range(1, 11):
# if i % 3 == 0:
# # continue
# break
# print(i)
# else:
# print('循环结束') # break不会打印此句,所有循环都正常结束才会执行else # a = 1
# if a > 0:
# pass # 占位的作用,使得语法不报错,保持程序结构的完整性
# if a == 1:
# print(a) # for i in range(1, 10):
# for j in range(1, 10):
# print('*',end=' ')
# print('') # for i in range(1, 10):
# for j in range(1, 10):
# if i == 1 or j == 1 or i == 9 or j == 9:
# print('*',end='')
# else:
# print(' ',end='')
# else:
# print('') # w = input('请输入宽')
# h = input('请输入高')
# h = int(h)
# w = int(w)
# for i in range(1, h+1):
# for j in range(1, w+1):
# if i == 1 or j == 1 or j == w or i == h:
# print('*', end=' ')
# else:
# print(' ', end=' ')
# print('\n') # for i in range(1, 10):
# for j in range(1, i + 1):
# a = j * i
# print('%d*%d=%2d' % (j, i, a), end=' ')
# print() # 元祖
#
a = (1, 2, 3)
# a = 1, 2, 3
# a = 1,
# a = (1,)
#
# a = (1, 2, 3)
# # a[0]=2 #元祖不支持赋值
#
# a = 1, 2, 3
# b = 4, 5, 6
# print(a + b)
# print(a * 3)
# print(a.index(3)) # 没懂
# print(a.count(6))
# a = (1, (2, 3))
# print(a)
#
# b = ([1, 2, 3], (4, 5, 6))
# b[0][-1] = 'haha'
# print(b) # a = 'hello'
# for i in a[::-1]:
# print(i, end='')