#_*_coding:utf-8_*_
#课堂练习1
# print('start....')
# while True:
# name =input('Please enter your name:')
# pwd = input('please enter your pwd:')
# if name == 'egon' and pwd == '123':
# print('login successful')
# else:
# print('user or pwd err')
# print('end...')
# print('start..')
# tag = True
# while tag:
# name = input('please your name>>:')
# pwd = input('Please your pwd>>:')
# if name == 'oOC' and pwd =='123':
# print('login successful')
# tag = False
# else:
# print('usr or pwd err')
#
# print('end..')
#课堂练习2 break 强行终止本层循环
# count = 1
# while count < 6:
# print(count)
# count+=1
# count = 1
# while True:
# if count > 5:
# break
# print(count)
# count += 1
# print('star...') #输入错误一直输
# while True:
# name = input('Please your name>>:')
# pwd = input('Please your password>>:')
# if name == 'oOC' and pwd == '123':
# print('login successful')
# break
# else:
# print('usr or pwd err')
#
# print('end ...')
# print('star...')
# count = 0
# while True:
# if count == 3 :
# print('输错次数太多')
# break
# name = input('Please your name>>:')
# pwd = input('Please your pwd>>:')
#
# if name == 'egon' and pwd == '123':
# print('login successful')
# break
# else:
# print('user or pwd err')
# count +=1
# print('end...')
#打印0-10
# count = 0
# while count <= 10:
# print('loop',count)
# count +=1
#打印0-10之间的偶数
# count = 0
# while count <= 10:
# if count%2 == 0:
# print('loop',count)
# count += 1
#打印0-10之间的奇数
# count = 0
# while count <= 9:
# if count%2 ==1:
# print('loop',count)
# count +=1
#死循环
# import time
# num = 0
# while True:
# print('count', num)
# time.sleep(1)
# num+=1
#循环嵌套与tag
# name='egon'
# password='123'
#
# while True:
# inp_name=input('用户名: ')
# inp_pwd=input('密码: ')
# if inp_name == name and inp_pwd == password:
# while True:
# cmd=input('>>: ')
# if not cmd: #cmd输入为假是 not cmd 为真 进行continue
# continue
# if cmd == 'quit':
# break
# print('run <%s>' %cmd)
# else:
# print('用户名或密码错误')
# continue
# break
#tag
# name='egon'
# password='123'
#
# tag=True
# while tag:
# inp_name=input('用户名: ')
# inp_pwd=input('密码: ')
# if inp_name == name and inp_pwd == password:
# while tag:
# cmd=input('>>: ')
# if not cmd:continue
# if cmd == 'quit':
# tag=False
# continue
# print('run <%s>' %cmd)
# else:
# print('用户名或密码错误')
#使用while循环输出1 2 3 4 5 6 8 9 10
# count = 0
# while count < 10:
# count += 1
# if count == 7:
# continue
# print(count)
#求1-100内的所有数的和
# count = 1
# sum = 0
# while count <=100:
# sum = sum + count
# count += 1
# print(sum)
#输出1- 100内的所有奇数
# count = 1
# while count < 100:
# if count % 2 == 1:
# print(count)
# count += 1
#输出1- 100内的所有偶数
# count = 1
# while count <= 100:
# if count % 2 == 0:
# print(count)
# count += 1
#求1-2+3-4+5 ... 99的所有数的和
# tag = 1
# count = 1
# sum = 0
# while count <= 99:
# sum = sum + tag * count
# tag *= -1
# count += 1
# print(sum)
#用户登陆(三次机会重试)
# name = 'oOC'
# password = '123'
# count = 1
# while count <= 3:
# in_name=input('Please enter your name:')
# in_pass=input('Please enter your password:')
#
# if in_name == name and in_pass == password:
# print('login success')
# break
#
# print('username or password is not correct!')
# count += 1
# name = 'oOC'
# password = '123'
# count = 1
# tag = True
# while tag:
# if count <= 3:
# in_name = input('Please enter your name:')
# in_pass=input('Please enter your password:')
# if in_name == name and in_pass == password:
# print('login success')
# break
# else:
# print('username or password is not correct!')
# count += 1
# else:
# print('login failed!')
# tag = False
#猜年龄
# num = 31
#
# count = 1
# while count <= 3:
# guess_num = input('Please enter the num:')
# guess_num = int(guess_num)
# if guess_num == num:
# print('Correct!')
# break
# else:
# print('Wrong!Please try again!')
# count += 1
# else:
# print('foolish!')
#猜年龄升级版
# num = 31
# count = 1
#
# while count < 4:
# guess_num = input('Please enter the num:')
# guess_num = int(guess_num)
# count +=1
# if guess_num == num:
# print('Correct!')
# break
# elif count == 4:
# tag = input('Could u play the game again?[Y/N]')
# if tag == 'Y':
# count = 1
# else:
# break
# else:
# print('Wrong!Please try again!')