标签:
#! /usr/bin/env python # -*- coding UTF-8 -*- import getpass a1 = input("inputusername:") a2 = getpass.getpass("inputpassword:") print(a1) print(a2)
#! /usr/bin/env python # -*- coding:utf-8 -*- #输出1-100内的所有奇数 a = 1 while a <= 100: if a%2 == 1: print(a) a += 1
#! /usr/bin/env python # -*- coding:utf-8 -*- #输出1-100内的所有偶数 a = 1 while a <= 100: if a%2 == 0: print(a) a += 1
#! /usr/bin/env python # -*- coding:utf-8 -*- #求 1-2+3-4...99所有数的和 a = 1 sum = 0 while a <= 99: if a%2 == 1: sum = sum + a a += 1 else: sum = sum -a a += 1 print(sum)
#! /usr/bin/env python # -*- conding:utf-8 -*- import time t1 = 1 while t1 < 4: username = input(‘please input your username:‘) password = input(‘password:‘) if username == ‘zhangsan‘ and password == ‘yes‘: print(‘congratulations‘) break elif t1 <= 2: print(‘error‘) t1 += 1 continue else: print(‘forbbiden‘) time.sleep(10) continue
标签:
原文地址:http://www.cnblogs.com/wuyuemay/p/5648342.html