直接肝程序吧!
""" # 作业六:用户登录测试(三次机会) count = 1 while count <= 3: user = input('请输入用户名: ') password = input ('请输入密码: ') if user == 'dachao' and password == '123': print ('你真厉害!!!') break else: print ('再试一次呦!') count+=1 """ """ # 作业四:输出1-100内所有的偶数 i = 1 while i <= 100: if i%2 == 0: print (i) i+=1 """ """ # 作业三:输出1-100内的所有奇数 i = 1 while i <= 100: if i%2 != 0: print (i) i+=1 """ """ # 作业二:求1-100的所有数的和 i = 1 sum = 0 while i <= 100: sum = sum + i i+=1 print (sum) """ """ # 作业一:while 循环输出1 2 3 4 5 6 8 9 10 无7 !!! i = 1 while i <= 10: if i !=7: print (i) # i+=1 # else: # i+=1 # continue i+=1 """ """ name = input ('请输入用户名: ') password = input ('请输入密码: ') if name == 'dachao' and password == '123': print ('user login successful') else: print ('user or code is wrong!') """ """ #通过tag的True赋值,实现用户名和密码必须为真进行下一步,否则无线循环的目的。 tag = True while tag : username = input ('input username: ') password = input ('input password: ') if username == 'dachao' and password == '123' : while tag : cmd = input ('>>: ') if cmd == 'q' : tag = False continue print ('------->%s' %cmd) """ """ #九九乘法表 for i in range(1,10) : for j in range(1,i+1) : print ('%d*%d=%d' %(i,j,i*j),end = ' ') print () #每次执行语句自动占用一行,“/n”代表空一行 """ """ name = input ('请输入用户名: ') if name == 'dachao' : print ('你最牛逼!') elif name == 'xiaochao' : print ('你可以的!') else: print ('你还需努力呢!') """ """ while True: print ('123') print ("456") continue """ """ import getpass password = getpass.getpass ('请输入密码: ') print (password) #自带idle不支持隐藏回显。 """