I am making a game and i need your help!


#1

hi i am making a simple game were you just guess a number but were 5 percent of the time it lies to you and i cant figu out who to get it to lie to me. please help
heres my code:

start = 'yes'

qwe = raw_input('want to play a game?:')
if qwe == start:
    import random
    value = random.randrange(1, 100)
    original = -1
    score = 0
    while original != value:
        score = score + 1
        original = int(raw_input('pick a number between 1 and 100:'))
        if original == value:
            print "you win your score is", score
        elif original >value:
            print 'too high'
        else:
            print 'too low'
else:
    print "that's unfortunate"

#2

Put this in an appropriate place ...

# lie 5% of the time
should_i_lie = random.randrange(1, 20) == 20

Then use should_i_lie as the condition in an if block header.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.