I am working on a guessing game in Python and would like some feedback on how the code looks. I am struggling a bit with it, particularly with the menu options and getting it to loop back to the menu again after it has written to a high scores txt file (haven't put in this part of the code yet).
Could you please look over the code and comment on what and where I need to improve them. Thanks in advance.
import random input = "V" or "P" or "Q" guesses = 0 guessesTaken = guesses +1 guess = number print 'What is your name? ' yourName = raw_input() def main(): Input = 0 menu = ''' Menu:\n (V)iew High Scores\n (P)lay Game\n (Q)uit Game''' print menu try: a = str(raw_input(" : ")) except: print " Cannot convert input to string, please do not enter a number\n " while input != "V": if input != "P" : input == "Q" break else: print " Please choose V, P or Q\n" print menu a = str(raw_input(" : ")) if __name__ == "__main__": main() number = random.randint(1, 42) print 'Please enter your guess, between 1 and 42: ' while guesses != number: if guess < number: print 'My number is higher.' if guess > number: print 'My number is lower.' if guess == number: break if guess == number: guessesTaken = str(guessesTaken) print 'Good job, ' + yourName + '! You guessed my number in ' + guessesTaken + ' guesses!'