Mega Code Archive

 
Categories / Python Tutorial / Introduction
 

A literal is a number or string that appears directly in a program

The following are all literals in Python: 42                       # Integer literal 3.14                     # Floating-point literal 1.0j                     # Imaginary literal 'hello'                  # String literal "world"                  # Another string literal """Good night"""                 # Triple-quoted string literal Using literals and delimiters, you can create data values of some other fundamental types: [ 42, 3.14, 'hello' ]    # List ( 100, 200, 300 )        # Tuple { 'x':42, 'y':3.14 }     # Dictionary