i know that when you define a variable in a function it is defined as a local variable.
and that when you type return variable it will set the value of that variable to a global variable and that it will then exit the function
but say i wanted to define variable x as a global variable and then do something else in the function
how would i do that?

to be a bit more specific i have this function:

  1. def sign_in(number,account,password):
  2.     if number.has_key(account) and number[account]==password:
  3.         account = account+".txt"
  4.         load_numbers(numbers,account)
  5.         display_menu()
  6.         return account
  7.     else:
  8.         print "Either the account name or password was wrong,\nplease remember that the account names are CASE SESITIVE"
  9.         print
  10.         welcome()
and i need to return account as a global variable before display_menu()
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to