摘要:
1 # 用户登录(三次机会重试) 2 i =0 3 4 while i < 3: 5 user = raw_input("username:") 6 pwd = raw_input("password:") 7 if user == "alex" and pwd == "123": 8 print( 阅读全文
摘要:
1 # 求1-2+3-4+5.....99的所有数的和(含等式) 2 s = "" 3 4 sum = 0 5 start = 1 6 7 while start < 100: 8 temp = start % 2 9 if temp == 1: 10 if start == 1: 11 s = s 阅读全文
摘要:
# 求1-2+3-4+5.....99的所有数的和(含等式)s = "" sum = 0start = 1 while start < 100: temp = start % 2 if temp == 1: if start == 1: s = str(start) else: s = s + "+ 阅读全文
摘要:
# 输出 1-100 的奇数 start = 1 while start <= 100: temp = start % 2 if temp == 1: print(start) else: pass start += 1 # 输出1-100 偶数 start = 1 while start <= 1 阅读全文