IndexPythonJapaneseChainmailleLeather

Data Types

When data is stored, it is either stored as a string, integer, or floating-point value


  Integer (int):
   All whole (non-decimal) negative and positive numbers (including 0)
   print(2)
    2
   print(1 + 1)
    2
  Use int() to convert values to integer data type


  Floating-point (float):
   All real numbers (integers + decimals)
   print(2.1)
    2.1
   print(2.1 + 2.1)
    4.2
  Use float() to conver values to floating-point data type


  String (str):
   Unlike int or float, an str is the phyical character with no numeric value.

   Strings must be encapsulated in "" or '' or """"""
   "Hello world" or 'Hello world'
   "" or '' creates an empty string

  The below will preserve the line break in the output
   """Hello
   world"""

  String Concatenation
   Join 2 or more strings
    print("Hello " + "world")
     Hello world
   Specify number of time to print string
    print("Hello" * 2)
     HelloHello
  Use str() to convert values to string data type
  Use chr() to convert numbers to unicode characters
  Use ord() to convert unicode characters to their number values
HomeData TypesVariablesFunctionsEscape SequencesProgram Comments