for i in range(1, 101): print(i)
num = 1 sum = 0 while num < 101: sum += num num += 1 print(sum)
i = 1 while i < 7: if i == 5: print('') else: print(i) i += 1
for i in range(1, 101): if i % 2 != 0: print(i)
username = 'liangxiao' password = '123..com' username_in = input('请输出您的名字:') password_in = input('请输出您的密码:') num = 1 while num < 4: num += 1 if username_in == username and password_in == password: print('登录成功!欢迎您的回归!') break else: print('账号密码不匹配,请确认后重新输入!') num = 4 - num num = '您当前还剩余输入次数机会%d' % (num) print(num) username_in = input('请输出您的名字:') password_in = input('请输出您的密码:')
name = input('请输出你的名字:') age = input('请输出你的年龄:') information = ''' 你的个人信息如下: 你的名字:%s 你的年龄:%s ''' % (name, age) print(information)
6 or 2 > 1 = 6 3 or 2 > 1 = 3 0 or 5 < 4 = false 5 < 4 or 3 = 3 2 > 1 or 6 = true 3 and 2 > 1 = true 0 and 3 > 1 = false 2 > 1 and 3 = 3 3 > 1 and 0 = 0 1 > 2 or 4 < 7 and 8 == 8 3 > 1 and 2 or 2 < 3 and 3 and 4 or 3 > 2 = 2 not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6 = false
num = 0 sum = 0 while num < 100: num += 1 if num == 88: continue elif num % 2 != 0: sum += num else: sum -= num print(sum)
input1 = input('请输出您需要注册的密码:') sensitive_words = ['小粉锤', '大铁锤'] i = 0 while i < 3: if input1 in sensitive_words: print('您输出的内容有误,请重新输入!') input1 = input('请输出您需要注册的密码:') else: print('输出正确,登录成功!') print('欢迎您的回归!') break i += 1
code = 'ac8e' code_input = input('请输出验证码:') if code_input.upper() == code: print('验证通过') else: print('验证失败')
li = [] username = input('>>>请输出您需要添加的用户:') while true: if username.upper() != 'q': li.append(username) print('添加成功') operation = input('是否继续?(y/n)') if operation.upper() == 'y': username = input('>>>请输出您需要添加的用户:') elif operation.upper() == 'n': print('welcome to use this program!') break else: print('您的输入有误!') username = input('>>>请输出您需要添加的用户:') else: print('welcome to use this program!') break
list1 = [11, 22, 33, 44, 55, 66, 77, 88, 99] dict1 = {'key1':'', 'key2':''} list2 = [] list3 = [] for i in list1: if i > 66: list2.append(i) else: list3.append(i) dict1['key2'] = list2 dict1['key1'] = list3 print(dict1)
list1 = ['手机', '电脑', '鼠标垫', '游艇'] for i in list1: print('{}\t{}'.format(list1.index(i)+1,i)) while 1: choose = input('请输出您的选择:(1-4)') if choose.isdigit(): if int(choose) > 0 and int(choose) < 5: print('输入正确!') print(list1[int(choose)-1]) break else: print('您输入的序列有误,请重新输入!') continue elif choose.isalpha(): if choose.upper() == 'q': print('good-bye!') break else: print('退出失败,您的输出有误') continue else: print('您的输入有误,请重新输入!')
while 1: username = input('请输出您需要注册的账号:') password = input('请输出您需要注册的密码:') if username.isalnum() and password.isalnum(): print('可以注册√') username_new = input('请再次确认您需要注册的账号:') password_new = input('请再次确认您需要注册的密码:') if username_new == username and password_new == password: print('注册成功!') break else: input('注册信息有误,请重新输入\n') username_file = open('username', mode='a', encoding='utf-8') password_file = open('password', mode='a', encoding='utf-8') username_file.write(username) password_file.write(password) username_file.close() password_file.close() for i in range(3): login_username = input('请登录用户名:') login_password = input('请登录密码:') username = open('username', mode='r', encoding='utf-8') password = open('password', mode='r', encoding='utf-8') read_user = username.read() read_pass = password.read() if login_username == read_user and login_password == read_pass: print('登录成功!') break else: ii = i + 1 num = 3 - ii print('登录失败,请重新登录!您还剩余{}次数'.format(num)) else: print('账号已锁定!')
如对本文有疑问, 点击进行留言回复!!
1.4.2 安装StanfordNLP并编写Python接口类 1.4.3 执行Stanford词性标注
网友评论