I have this code:

def welcome():
    '''========Welcome to Jaron's=======
    ====Video Game Rental Service===='''
    
def menu():
    while True:
        print '''0-\t Exit
1-\t Register
2-\t Log-in
3-\t Browse
4-\t Read-me'''
        try:
            menu_choice=int(raw_input('Please make a selection by number: '))
            global menu_choice
            break
        except ValueError:
            print "Oops, it seems like you made a mistake. Try again by entering a number between 0 and 5."
    
def register():
    print 'Please fill out the form below to register'
    username=raw_input('Username: ')
    while True:
        password=raw_input('Password: ')
        confirmpassword=raw_input('Confirm Password: ')
    if password==confirmpassword:
        break
    else:
        print "Oops, it seems like you made a mistake. Try again by entering the same password in the 'Password field' as the 'Confirm Password' field."
    firstname=raw_input('First name: ')
    lastname=raw_input('Last name: ')
    dayofbirth=raw_input('Day of Birth: ')
    monthofbirth=raw_input('Month of Birth: ')
    yearofbirth=raw_input('Year of Birth: ')
    pay_info()
            
def pay_info():
    print 'Which type of payment would you like to use?'
    while True:
        print '''0-\t Exit
1-\t Paypal
2-\t Visa
3-\t Master Card'''
        try:
            payment=int(raw_input('Please make a selection by number: ')
            global payment
            break
        except ValueError:
            print "Oops, it seems like you made a mistake. Try again by entering a number between 0 and 3."

welcome()
menu()
if menu_choice==1:
    register()

and I get an error that looks like this:

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
>>> [evaluate CAT.py]
Traceback (most recent call last):
File "<string>", line 45, in <fragment>
invalid syntax: <string>, line 45, pos 18
>>>

I don't see what the problem is with setting payment to a global variable, and even if I remove that line I still get an error with the break section. Any help is great.

Thanks,


Jaro

Recommended Answers

All 3 Replies

Match up the parens on the previous, raw_input, statement. Also, the welcome() function does nothing.

commented: yes +15

Lol, I feel stupid now...

Lol, I feel stupid now...

That's always the case __after__ you find the problem.

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.