371 views, 0 RAMs, and 2 comments
I've recently started learning computer programming and picked up Python but I need some help with new terms. What exactly do "global variables" in Python do?
Smoke weed literally every day unless you don't want to go to hell.
Basically a global variable is defined and declared outside a function and needed to be used inside of a function. For a good example on how this works this website explains it well:
Variables that are created outside of a function are known as
Global Variables. A global variable is one that can be accessed anywhere . This means, global variable can be accessed inside or outside of the function. In most cases where you are tempted to use a global variable, it is better to utilize a parameter for getting a value into a function or return a value to get it out. Like in many other program structures, Python also imposes good programming habit by design.
Mod Edit: Spam link removed.
Post a New Comment
Do you like having a good time?
Register an Account
Read Quality Articles
Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.
Argue with People on the Internet
Use your account to explain why people are wrong on the Internet forum.
Vandalize the Wiki
Or don't. I'm not your dad.
Ask and/or Answer Questions
If someone asks a terrible question, post a LMGTFY link.
Make Some Money
Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.
Answers— Read More
Find more related content below!
- [Solved] Indexing database tables for "WHERE LIKE '%string%'" queries in MySQL
- [Solved] SQLite: "Error: near line 27: near "IGNORE": syntax error"
- [Python] How do global variables work?
- What are some good PHP interview questions to ask potential developers?
- Does GROUP BY remove duplicates?
- Fix "Response to preflight request doesn't pass access control check"?
- How do I apply Chi-Square test in R?
- NodeJS error "Can't set headers after they are sent"?
- How to remove duplicates from sorted array?
- How do you fix "unexpected end of JSON input"?