美文网首页
无标题文章

无标题文章

作者: MARKMOSS | 来源:发表于2015-05-22 11:14 被阅读0次

    在此记录下Python的某段小程序,以此证明python的简单实用性

    就是这个
    

    <

    !/usr/bin/python

    Filename: while.py

    number = 23
    running = True

    while running:
    guess = int(raw_input('Enter an integer : '))

    if guess == number:
        print 'Congratulations, you guessed it.' 
        running = False # this causes the while loop to stop
    elif guess < number:
        print 'No, it is a little higher than that' 
    else:
        print 'No, it is a little lower than that' 
    

    else:
    print 'The while loop is over.'
    # Do anything else you want to do here

    print 'Done'’>

    相关文章

      网友评论

          本文标题:无标题文章

          本文链接:https://www.haomeiwen.com/subject/jholqttx.html