English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

Write the basic rules for a global keyword in python. - Computer Science

Advertisements
Advertisements

Question

Write the basic rules for a global keyword in python.

Short Note

Solution

The basic rules for the global keywords in Python are:

  1. When we define a variable outside a function, it’s global by default. You don’t have to use global keywords.
  2. We use a global keyword to read and write a global variable inside a function.
  3. Use of global keywords outside a function has no effect.
shaalaa.com
Variable Scope
  Is there an error in this question or solution?
Chapter 7: Python functions - Evaluation [Page 113]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 7 Python functions
Evaluation | Q 2. | Page 113
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×