File: guess

package info (click to toggle)
sugar-pippy-activity 25-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 572 kB
  • ctags: 234
  • sloc: python: 1,237; makefile: 15
file content (18 lines) | stat: -rw-r--r-- 404 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import random
import pippy
R = random.randrange(1,100)

print "Guess a number between 1 and 100!"
N = input("Enter a number: ")
i=1
while (N!=R):
    if N>R:
        pippy.console.red()
        print "Too big... try again"
    else:
        pippy.console.blue()
        print "Too small.. try again"
    pippy.console.black()
    N = input("Enter a number: ")
    i=i+1
print "You got it in", i, "tries"