GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing codescracker.com — Python None Keyword
Python None KeywordThe "None" keyword in Python is used when we need to declare a variable with no value at all. The interesting thing about the None keyword is that it is a constant value with no value at all. "None" is neither a 0 nor an empty string like "". That is, "None" is none, nothing else. For example: a = None b = 0 c = "" print(type(a)) print(type(b)) print(type(c)) The output is: <class 'NoneType'> <class 'int'> <class 'str'> It means that, like 0 is of the "int" type, "" is of the "str" type. Similarly, "None" is of the "NoneType" value. Note: Python is a case-sensitive language; therefore, keep the first letter of the None keyword in capital letters, and the remaining 3 letters must be in small letters. Python None Keyword ExampleHere is an example of the None keyword in Python. This program demonstrates that a function with no return value will return None. def funOne(): x = 10 def funTwo(): x = 100 return x x = funOne() print(x) x = funTwo() print(x) The output is: None 100 Advantages of the None keyword in PythonFollowing is a list of some of the advantages of the "None" keyword in Python.
Disadvantages of the None keyword in PythonFollowing is a list of some of the disadvantages of the "None" keyword in Python.
« Previous Tutorial Next Tutorial » Practice Quizzes
Test your programming and computer science knowledge with interactive MCQs and topic-based quizzes. Popular Topics
Explore the most popular programming and computer science tutorials on CodesCracker. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |