里面主要涉及到while,for循环,if..else判断 代码如下:

 fage = False
 mage =False
 bage=False
 father_age = 42
 mather_age=41
 boy_age=15
 print("Let's guess the age!")
 while fage == False: #当fage这个值等于False时,进入循环
    guess_father =int(input('\nyour guess father_age:')) #输入你所猜测的父亲年龄
    if guess_father == father_age:
        print('you right!\n')
        fage = True
    else:
        print('\nyour is error!')
        if guess_father < father_age:
            small = father_age - guess_father #当你猜测的数比答案小时,用答案减去猜测数等于相差数值
            print('maybe is small!differ:', small)
        elif guess_father > father_age:
            big =guess_father  - father_age
            print('maybe is big!differ:', big)
 while mage == False:
    guess_mather =int(input('\nyour guess mather_age:'))
    if guess_mather == mather_age:
        print('you right!\n')
        mage = True
    else:
        print('\nyour is error!')
        if guess_mather < mather_age:
            small = mather_age - guess_mather
            print('maybe is small!differ:', small)
        elif guess_mather > mather_age:
            big = guess_mather - mather_age
            print('maybe is big!differ:', big)
 while bage == False:
    guess_boy =int(input('\nyour guess boy_age:'))
    if guess_boy == boy_age:
        print('you right!\n')
        bage = True
    else:
        print('\nyour is error!')
        if guess_boy < boy_age:
            small = boy_age - guess_boy
            print('maybe is big!differ:', small)
        elif guess_boy > boy_age:
            big = guess_boy - boy_age
            print('maybe is big!differ:', big)