Skip to content

None Type & Others

None Type and Built-in Functions

None

  • None is a special data type in Python that represents the absence of a value or a null value.
  • It is often used as a default return value for functions that do not explicitly return anything.
  • Example:
result = print("Hello")
print(result)   # Output: None

Common Built-in Functions

str() → Converts a value into a string. Example: str(123) → "123"

int() → Converts a value into an integer (whole number). Example: int("10") → 10

float() → Converts a value into a floating‑point number. Example: float("3.14") → 3.14

type() → Returns the type of a variable or value. Example: type(5) →

print() → Displays output to the console. Example: print("Hello") → prints Hello

len() → Returns the length of a sequence (string, list, tuple, etc.). Example: len("Python") → 6

input() → Reads user input from the console as a string. Example:

name = input("Enter your name: ")
print(name)

bool() → Converts a value into a Boolean (True or False). Example: bool(0) → False, bool(5) → True