摘要:
默认使用空格切, 阅读全文
摘要:
第一次的if判断直接嵌入到第二次动态输入的while中 注意while后面必须加判断语句.if不成立直接循环while语句 阅读全文
摘要:
s = '123456789' # 获取s字符串中前3个内容 print(s[:3:]) #从0开始计数 最后一个不计不填默认从左... 阅读全文
摘要:
a=1 b=2 while a<4: user=input('请输入账户') pswd=input('请输入密码') if user=='123' and pswd=='456': print('正确') else: print('你还有%s次机会'%(b)) b=b-1 a=a+1 阅读全文
摘要:
a=1 while a<101: if a%2==1: print(a) a=a+1 a=0 while a<99: a=a+1 print(a) 阅读全文
摘要:
a=1 b=0 while a<101: if a%2==1: b=a+b a=a+1 c=1 d=0 while c<101: if c%2==0: d=d-c c=c+1 print(b+d) 阅读全文
摘要:
a=1 b=0 while a<101: b=a+b a=a+1 else: print(b) a=1 b=0 while a<101: if a%2==1: b=a+b a=a+1 c=1 d=0 while c<101: if c%2==0: d=d+c c=c+1 print(b+d) 阅读全文
摘要:
c=1 while c <= 3: a = input("请输入用户") b = input("请输入密码") if a=='alex' and b=='alex3714': print('欢迎') break else: print('用户名或密码错误') c = c + 1 阅读全文
摘要:
count=1 while 10>count: if count==7: count=count+1 continue #可有可无 print(count) count=count+1 阅读全文
摘要:
while 3>2: a=(input("输入账号")) b=(input("输入密码")) print(f''' #f格式化方式 你的账号是:{a} 你的密码是:{b} ''') print(''' #%s占位符格式化 你的账号是:%s 你的密码是:%s '''%(a,b)) 阅读全文