import random

def main(max):
    print "\tWelcome to 'Guess my number'!"
    print "\nI'm thinking of a number between 1 and 100."
    bestoutof = raw_input("Best out of : ")

    num = random.randrange(101)
    tries = bestoutof
    guess = ""
    while guess != num:
        guess = int(raw_input("Take a guess: "))
        if guess > num:
            print "Too high."
        elif guess < num:
            print "Too low."
        
        
        if tries >= bestoutof:
            print "Sorry, you took too many guesses. Game Over"
            exit()
            
    print "Congratulations!"
    again = raw_input("To play again press Enter. Type anything else to quit.")
    if again == "":
         main()
    else:
        exit

main(3)

i need it to have a best of ? loop it be in this program but i just cant seem to get it right

Any suggestion ?????
:(

See comments!

import random

def main(max):
## max is poor parameter name as it is used by python and you can
## not use max function after this
## parameter is never used
    print "\tWelcome to 'Guess my number'!"
    print "\nI'm thinking of a number between 1 and 100."
    bestoutof = raw_input("Best out of : ")

    num = random.randrange(101)
    tries = bestoutof         ### what is the reason, forgot something?
    guess = ""
    while guess != num:
        guess = int(raw_input("Take a guess: "))
        if guess > num:
            print "Too high."
        elif guess < num:
            print "Too low."
        
        
        if tries >= bestoutof: ## tries is some text user input, bestoutof has same value
            print "Sorry, you took too many guesses. Game Over"
            exit()
        ## tries does not change
    print "Congratulations!"
    again = raw_input("To play again press Enter. Type anything else to quit.")
    if again == "":
         main()
    else:
        exit

main(3)

i need it to have a best of ? loop it be in this program but i just cant seem to get it right

Any suggestion ?????
:(

In the again loop
you don't specify the max value for main

]if again == "":
         main() #main(3) f.e.

btw why do you use the max anyway?

but i just cant seem to get it right

Show us what you have tried and we will help make it work. It appears that you copied some simple rock-paper-scissors, and guess-the-number code from somewhere and now want us to modify it for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.