Francais

Francais


Home


Products


Download


Tutorials

    Python Section
  • Python Quick Reference

  • Web Ring/Links


    Contact

    The interpreter

    The Python command's interpreter launched by the command with the same name. The prompt >>> shows when the interpreter waits for a command. Another prompt … tells the user that the next command will belong to the current block. A block of command ends generally by an empty line. The tutorial's examples use the interpreter prompts to make the difference between commands and their output. 

    Comment

    A comment in Python begin with a # (cardinal) and finish at the end of line.

    Example :
    # This is a comment

    Variables  Overview

    The variable's names are case sensitive. The variable Toto is not the same as TOTO. A variable exists only when assign. The assign gives the kind of variable and its value. Assigns an existing variable allows the change of its type.

    Example :
    >>> A=0
    >>> print A 
    0
    >>> A+=1
    >>> print A
    1
    >>> A=0
    >>> a=2
    >>> print A
    0
    >>> A=0
    >>> print A
    0
    >>> A= "titi"
    >>> A+=1
    "cannot concatenate 'str' and 'int' objects"

    Integer Variable

    An integer variable is created by the assignment of an integer or by the int() function.

    Example :
    >>> A=0
    >>> print A
    0
    >>> A=int("0")
    >>> print A
    0

    Floating Variable

    A floating variable is created when the formula assigns contains at least one floating number or by using the float() function.

    Example :
    >>> A=5.0
    >>> print A
    5.0
    >>> A=5+.0
    >>> print A
    5.0
    >>> A=float("0")
    >>> print A
    0.0



    Previous Page
    2/13

    Next Page