Wednesday, July 21, 2021

# 6. Python Keywords and Literals

 Python Keywords and literals

Python Keywords:

Keywords are the reserved words in Python.



We cannot use a keyword as a variable name, function name, or another identifier. They are used to define the syntax and structure of the Python language. In Python, keywords are case-sensitive. There are 33 keywords in Python 3.7.

All the keywords except True, False and None are in lowercase and they must be written as they are.

True, False, None, For, While, if, else, elif, break, continue, return, from, def, class, print, and, or, not, import, etc.

Python Literals:

literals in python are raw data for a variable

example: a = 10,    # here 10 is the raw data assigned to a variable.

         Types of literals:

Boolean à True, False

Numeric à int, float, complex  

String à single line, multiline  

Special à None     

Collection à List, Tuple, Dictionary, Set

User Defined names:

In python, we can define our own names for

Variable names

Function names

Class names

Structure names

 

No comments:

Post a Comment

# 7. Type conversion in Python

                                      Type Conversion in Python Python defines type conversion functions to directly convert one data type t...