Day4 作业

#print(3>4 or 4<3 and 1==1)
# f or f
# f
# x or y x为真,返回x,否则返回y
# x and y x为真,返回y,否则返回x
#print(2 > 1 and 0)
#print(1 < 2 and 3 < 4 or 1>2)
# t or f
# t

#print(2 > 1 and 3 < 4 or 4 > 5 and 2 < 1)
#t or f
#t

#print(1 > 2 and 3 < 4 or 4 > 5 and 2 > 1 or 9 < 8)
#f or f or f
#f


#print(1 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6)
# f or f or f
#f

#print(not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6)
#f or f or f
#f
#1-2+3-4...+99除88以外的所有数的总和
# sum = 0
# count = 0
# while count < 99:
# count += 1 #输出1-99
# #print(count)
# if count == 88:
# continue
# if count % 2 == 0:
# sum -= count
# else:
# sum += count
# print(sum)
#
# digit = 3 #计次
# while digit > 0:
# username = input('请输入账号>>>')
# if username == '%s'%username :
# print('账号输入正确!')
# user = username
# password = input('请输入密码>>>')
# if password == 'jun':
# print('''登录成功!
# 您的账号为%s
# 您的密码为%s'''%(username,password))
# break
# else:
# digit -= 1
# print('密码输入有误,请重新输入,您还有%s次机会' %digit)
#
#
# else:
# digit -= 1
# print('账号输入有误,请重新输入,您还有%s次机会'%digit)
# else:
# print('要点脸行不!')
# s = input('>>')
# if s:
# print('bu为空')
# else:print('为空')
# s = input('>>>')
#
# for x in s:
# if not x.isdigit():#如果x不是数字
# s = s.replace(x,' ') #把不是数字的替换成空格
#
# s1 = s.split(' ') #分割文本
# print(s1)
# sum = 0
# for x in s1:
# if x.isdigit(): #如果是数字,就自加
# sum += int(x)
#
# print(sum)
# li = ['alex','wusir','eric','rain','alex']
# print(len(li))
# li.append('seven')
# print(li)
# li.insert(0,'tony')
# print(li)
# li[1] = 'Kelly'
# l2 = [1,'a',3,4,'heart']
# li.extend(l2)
# s = 'qwert'
# li.extend(s)
# del li[1:4]
# li.reverse()
# print(li.count('alex'))

# li = [1,3,2,'a',4,'b',5,'c']
# l1 = li[0:3]
# l1.sort()
# l1 = li[3:-2]
# l1 = li[0:-1:2]
# l1 = li[1:-2:2]
# l1 = li[-1:]
# l1 = li[-3:0:-2]
# li = [2,3,'k',['qwe',20,['k1',['tt',3,'1']],89],'ab','adv']

# li[3][2][1][0] = li[3][2][1][0].upper()
# li[3][2][1][0] = 'TT'

# 5,查找列表li中的元素,移除每个元素的空格,
# 并找出以’A’或者’a’开头,并以’c’结尾的所有元素,
# 并添加到一个新列表中,最后循环打印这个新列表。
# li = ['taibai ','alexC','AbC ','egon',' Ritian',' Wusir',' aqc']
# l1 = []
# for x in li:
# i = x.strip() #查找列表li中的元素,移除每个元素的空格
# s = i.lower()
# print(s)
# if s.startswith('a') and s.endswith('c'): #并找出以’A’或者’a’开头,并以’c’结尾的所有元素,
# l1.append(i)
# print(l1)


# 6、开发敏感词语过滤程序,提示用户输入评论内容,如果用户输入的内容中包含特殊的字符:
# 敏感词列表 li = ["苍老师","东京热",”武藤兰”,”波多野结衣”]
# 则将用户输入的内容中的敏感词汇替换成***,并添加到一个列表中;
# 如果用户输入的内容没有敏感词汇,则直接添加到上述的列表中。
# li = ["苍老师","东京热","武藤兰","波多野结衣"]
# new_li =[]
# s = input('>>>>')
# for x in li:
# if x in s:
# s = s.replace(x,'*'*len(x))
# print(s)
# new_li.append(s)
#
# print(new_li)
posted @ 2019-02-15 15:37  ChenGouDa  阅读(413)  评论(0编辑  收藏  举报