I dont know what problem is


#1



I wrote like this....but I CANNOT STOP Try Agains!
I dont know what is the problem..
and I think i spend too much time in debugging, is it right way to learn?


Replace this line with your code. 

from random import randint

rules = {
    1: 'rock',
    2: 'paper',
    3: 'scissors'
}
    
rules2 = {
    1: 'scissors',
    2: 'rock',
    3: 'paper'
}
for rounds in range(2):
    print "round", rounds +1
    player = int(raw_input(
'Enter a number:\nRock: 1\nPaper: 2\nScissors: 3'))
    cpu = randint(1,3)
    print player
    print cpu
    print "You picked %s and Computer picked %s" %(rules[player], rules2[cpu])
    start=True
    while start:
        if player == cpu:
            print "YOu Win!"
            break
        else:
            print "Try Agian"
            if rounds>3:
                break


#2

Too much indentation. This should not be in the else:

For some, maybe, but for most it is better to master the concepts your project is using before embarking. Have an adequate tool kit at your disposal in the planning stages so you can pseudo code and blueprint. After that, the writing and debugging will be simple and straight forward.

  1. Know what you have for consumables (data, etc)
  2. Know what you expect
  3. Think it through in reverse as well as forward. You may come up with two entirely different plans.

#3

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