Please i need help on 8/19 ...and seek!


#1



Replace this line with your code.


#2

i messed up my first topic i made. here is my code

from random import randint

random_number = randint(1, 10)

guesses_left = 3

while guesses_left > 0:
guess = int(raw_input("Your guess: "))
guesses_left -= 1
if guess == random_number:
print "You win!"
break
else:
print "You lose."


#3

what error message are you getting?


#4

Oops, try again. Did you declare a variable called guess_row?


#5

Hi can you take a screenshot of your code?

OR

Are you on lesson @caeleb

Your own while / else


#6

i don't know how to take a screenshot of my code


#7

the lesson name is ...and seek!


#8

SO it's that one ?
Battleship! - ...and Seek!
If so your code shouldn't be like the one you posted


#9

then how should it be?


#10

part of it should be like that

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)

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

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

#11

oh okay thanks for the help


#12

hi i am no where near battal ship


#13

def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "Los Angeles":
return 475


#14

do that it should work alexanderweaver