for循环:
for i in range(10): # i循环10次
print('------',i)
for j in range(10):
print(j)
if j > 2 :
break #跳出循环体
while循环:
age_oldboy_guess = 50
conet = 0
# age_guess = int(input('age_oldboy_guess:'))
# if age_oldboy_guess == age_guess:
# print('猜对了!')
# print('get over!') # 这一段已经写多余了。。
# exit()
# else:
# print('猜错了!')
while conet < 3 :
# for i in range(3):
age_guess = int(input('age_oldboy_guess:'))
if age_oldboy_guess == age_guess:
print('猜对了!')
break
else:
print('猜错了!')
conet += 1
# else:
# print("游戏结束!")
if conet == 3:
i = input('还想玩吗?继续请输入Y/y:')
if i == 'Y' or i =='y':
conet = 0
else:
break
print('get over!')
if--else循环:
name = input('name:')
sex = input('sex:')
age = int(input('age:'))
if sex == "f":
if age < 28 :
print("I LOVE girl!")
else:
print('2222!')
else:
print("1111")