python练习1:猜数字游戏
经验:注意只要遇到':的条件,最好是有缩进。
#!/usr/bin/python # Filename: if.py number = 23 guess = int(raw_input('Enter an integer : ')) if guess == number: print 'Congratulations, you guessed it.' print "(but you do not win any prizes!)" gress=False elif guess < number: print 'No, it is a little higher than that' else: print 'No, it is a little lower than that' print 'Done'