User interface nearly unusable for the past 2 days


#1

https://www.codecademy.com/courses/learn-python/lessons/battleship/exercises/play-it-sam

Traceback (most recent call last):
File “python”, line 28, in
ValueError: invalid literal for int() with base 10: ‘SCT’

<What do you expect to happen instead?>
I tested my code in Python 2.7.9 using IDLE and it worked multiple times without any error.
The automation on your website simply will not pass me.
For the past 2 days with multiple sections of the Python course, my code checks out fine when executed
in any other Python 2 environment, yet the smallest deviation from the expectations of your interface
throws up these errors. I have time after time reset the code and redone the assignments. I have exited the Python course entirely and restarted it in an effort to clear whatever short-term memory locations are loaded with failed expectations. And now part 15 of the Battleship section can’t be pleased.

This is frankly unacceptable. I have found great value in your educational material, but the tolerance for variance in functional input is ridiculously low. Also, in the past 2 days I can put in non-functional code about 3-6 times and afterwards, no matter how functional my code your evaluation code will only throw errors until I reset the code or exit and re-enter the unit and section.

It shouldn’t matter if my code is incomplete 20 or 30 times in a row. Every time I hit that Run button the code should execute and your evaluation code should reset and factor in only what is currently in the code window.

I am likely not the only person experiencing these problems. I appreciate that you are doing what you can, and I would sincerely like to continue to use your service succesfully and not have to go elsewhere for educational materials.
Thank you



from random import randint

board = []

for x in range(0, 5):
  board.append(["O"] * 5)

def print_board(board):
  for row in board:
    print " ".join(row)

print_board(board)

def random_row(board):
  return randint(0, len(board) - 1)

def random_col(board):
  return randint(0, len(board[0]) - 1)

ship_row = random_row(board)
ship_col = random_col(board)
print ship_row
print ship_col


for turn in range(4):
  guess_row = int(raw_input("Guess Row: "))
  guess_col = int(raw_input("Guess Col: "))

  if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sank my battleship!"   
  else:
    if guess_row not in range(5) or guess_col not in range(5):
      print "Oops, that's not even in the ocean."
    elif board[guess_row][guess_col] == "X":
      print( "You guessed that one already." )
    else:
      print "You missed my battleship!"
      board[guess_row][guess_col] = "X"
    print_board(board)
    print "Turn", turn + 1


https://www.codecademy.com/courses/learn-python/lessons/battleship/exercises/play-it-sam


#2

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