Python Forum
input defines variable but it's not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
input defines variable but it's not defined
#2
If you define a variable in a function, it only exists in that function (this is called scope). To get it out of that function, you need to use a return statement. To get it into another function, you use parameters to the function call. Details on all of this are in the function tutorials linked to in my signature.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: input defines variable but it's not defined - by ichabod801 - Jun-04-2017, 11:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Variable not defined even though it is CoderMerv 3 391 Mar-28-2024, 02:13 PM
Last Post: Larz60+
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 656 Nov-23-2023, 02:53 PM
Last Post: rob101
  Printing the variable from defined function jws 7 1,467 Sep-03-2023, 03:22 PM
Last Post: deanhystad
  input variable choice MCL169 7 1,251 Feb-19-2023, 09:00 PM
Last Post: MCL169
  [variable] is not defined error arises despite variable being defined TheTypicalDoge 4 2,239 Apr-05-2022, 04:55 AM
Last Post: deanhystad
  How to include input as part of variable name Mark17 4 2,577 Oct-01-2021, 06:45 PM
Last Post: Mark17
  Function will not return variable that I think is defined Oldman45 6 3,621 Aug-18-2020, 08:50 PM
Last Post: deanhystad
  trying to input a variable using random.choice python63 9 3,708 Aug-13-2020, 05:37 PM
Last Post: python63
  How to assign a module to a variable even if it's not defined? mandaxyz 5 3,354 Aug-12-2020, 10:34 PM
Last Post: snippsat
  Variable not defined Heyjoe 4 2,619 Jul-10-2020, 11:27 PM
Last Post: Heyjoe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020