Python Example – Write a Python program to list the special variables used within the language

(Python Example for Citizen Data Scientist & Business Analyst)


Write a Python program to list the special variables used within the language.


Sample Solution

Python Code:

s_var_names = sorted((set(globals().keys()) | set(__builtins__.__dict__.keys())) - set('_ names i'.split()))
print( '\n'.join(' '.join(s_var_names[i:i+8]) for i in range(0, len(s_var_names), 8)) )

Sample Output:

ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesW
ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError Deprecati
onWarning EOFError Ellipsis                                                                                   
EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning GeneratorE
IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError KeyError     
KeyboardInterrupt LookupError MemoryError NameError None NotADirectoryError NotImplemented NotImplementedError
OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceErr
or ResourceWarning 
 filter float format frozenset getattr globals hasattr hash                                                    
help hex id input int isinstance issubclass iter                                                              
len license list locals map max memoryview min                                                                
next object oct open ord pow print property                                                                   
quit range repr reversed round set setattr slice                                                              
sorted staticmethod str sum super tuple type vars                                                             


Write a Python program to list the special variables used within the language


Sign up to get end-to-end “Learn By Coding” example.



Applied Machine Learning & Data Science with Python, R and SQL.

A list of Python, R and MATLAB Codes for Applied Machine Learning and Data Science


Subscribe to our YouTube channel and press the ring to get latest update on Python and R coding recipesCoding is our strength.


Learn by Coding Categories:


Data Analytics:

Data Science:

Data Visualisation:

Machine Learning Recipe:




Supervised Learning:

Tabular Data Analytics:

End-to-End Data Science Recipes:

Applied Statistics:

Bagging Ensemble:

Boosting Ensemble:



Data Analytics:

Data Science:

Data Visualisation:

Decision Tree:


Machine Learning Recipe:

Multi-Class Classification:

Neural Networks:

Python Machine Learning:

Python Machine Learning Crash Course:

R Classification:

R for Beginners:

R for Business Analytics:

R for Data Science:

R for Data Visualisation:

R for Excel Users:

R Machine Learning:

R Machine Learning Crash Course:

R Regression:



Excel examples for beginners:

C Programming tutorials & examples:

Javascript tutorials & examples:

Python tutorials & examples:

R tutorials & examples:

SQL tutorials & examples:

SQL for Beginners in 2 Weeks:


Portfolio Projects for Aspiring Data Scientists: Tabular Text & Image Data Analytics as well as Time Series Forecasting in Python & R @



Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.