#!/usr/bin/python
#_*_coding:utf-8_*_
#简单的流程控制02,达到条件后,跳出。
name = raw_input('Input your name: ')
sex = raw_input('sex: ')
job = raw_input('job: ')
real_age = 26
for i in range(10):
age = input('age: ')
if age >26:
print 'think a little smaller!'
elif age == 26:
print '\033[32;1myou are right!\033[0m' #使用颜色区分答对的输出。
break #答对了跳出循环
else:
print 'think a little bigger!'
print 'you still got %s shots!' % (9 - i) #提示答错后还剩下几次机会。
#打印结果
print '''
personal information of %s:
name: %s
age: %s
sex: %s
job: %s
-----------------------------
''' % (name,name, age,sex,job)