我的第一个python程序

判断年龄大小并循环,计算次数

age_of_gordon = '39'
guest_count = 0
while guest_count <= 3:
    guest_age = input('Guest age:')
    if guest_age == age_of_gordon:
        print('你猜对了')
        #continue        #退出本次循环
        break              #退出本程序
    elif guest_age > age_of_gordon:
        print('你猜大了')
    else:
        print('你猜小了')
    guest_count += 1
    print('你已经猜了', guest_count, '次')
    if guest_count >=3:
        print("你已经猜了", guest_count, '次,是否还想继续猜?输入y/n')
        if input(guest_age) == 'y':
            guest_count = 0
        else:
            print('你一共猜了', guest_count, '次')
            break
上一篇:VirtualBox虚拟机CentOS安装增强功能Guest Additions


下一篇:win7共享打印机设置