Small improvement


Replace this line with your code.




Quick observation, perhaps it was too in depth at this point, but I would have liked to have had to add some code to ensure the user guess was an integer. As it is now one enters a non integrt and the code breaks.


This requires code which hasn't been taught yet:

while True:
        guess_row = int(raw_input("guess row: "))
        guess_coll = int(raw_input("guess coll: "))
    except ValueError:
        print "not vaild"


So mo simple solution such as an is num or is numeric.. bummer. Look forward to learning the tyy catch logic though.


you can use isinstance (see this stackoverflow question), but that is it. Try/except is quit pythonic way of solving this problem

Try except is not caught in this course


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