here is the code


import random #I need this to generate Random Numbers
print ("***********************************")
print ("    The game of Treasure Hunt      ")
print ("Our world has 5 rows and 5 columns")
print ("***********************************")
print ("Placing the treasure randomly")
# I need Print to show the player what we do
TRow =random.randint(1,5)
TCol = random.randint (1,5)
# I create two random numbers one for row 
# and one for columns
# because I want to randomly put the treasure somewhere
# TRow means treasure row 
# TCol means treasure column 
while 1:
    print ("Placing the Player randomly") 
    PRow =random.randint(1,5)
    PCol = random.randint (1,5)
    # I create two random numbers one for row 
    # and one for columns
    # because I want to randomly put the player somewhere
    # PRow means treasure row 
    # PCol means treasure column 
    if ( PRow != TRow and PCol != TCol):
        break
# The Above while loop tries to find a different place for the player 
# than the treasure 
#print ("Player is at ", end = "")
#print (PRow , end = "")
#print (",", end = "")
#print (PCol)
#print ("Traesure is at ", end = "")
#print (TRow , end = "")
#print (",", end = "")
#print (TCol)
#print ("Starting to play") 
Counter = 0
while 1:
    print ("You are at Row ", end = "")
    print (PRow)
    print ("And Col ", end = "")
    print (PCol)
    print ("Which Direction do you want to go")
    print ("U for Up")
    print ("D for Down")
    print ("L for Left")
    print ("R for Right")
    Direction = input()
    if Direction == "U" or Direction == "u":
        Counter = Counter + 1
        if PRow != 1:
            PRow = PRow - 1
            if (PRow == TRow and PCol == TCol):
                print("You found the treasure in " , end = "")
                print (Counter)
                print (" Moves to win!")
                break
        else: 
            print ("You are on the first row and can't go up")
            print ("Try again")
    if Direction == "D" or Direction == "d":
        Counter = Counter + 1
        if PRow != 5:
            PRow = PRow + 1
            if (PRow == TRow and PCol == TCol):
                print("You found the treasure in " , end = "")
                print (Counter)
                print (" Moves to win!")
                break
        else: 
            print ("You are on the Last row and can't go Down")
            print ("Try again")
    if Direction == "R" or Direction == "r":
        Counter = Counter + 1
        if PCol != 5:
            PCol = PCol + 1
            if (PRow == TRow and PCol == TCol):
                print("You found the treasure in " , end = "")
                print (Counter)
                print (" Moves to win!")
                break
        else: 
            print ("You are on the last column and can't go right")
            print ("Try again")
    if Direction == "L" or Direction == "l":
        Counter = Counter + 1
        if PCol != 1:
            PCol = PCol - 1
            if (PRow == TRow and PCol == TCol):
                print("You found the treasure in " , end = "")
                print (Counter)
                print (" Moves to win!")
                break
        else: 
            print ("You are on the first column and can't go left")
            print ("Try again")