Python is Interpreted: This means that it is processed at runtime by the interpreter and you do not need to compile your program before executing it. This is similar to perl and php. Python is Interpreted


Download 374 Kb.
bet3/5
Sana18.12.2022
Hajmi374 Kb.
#1027961
1   2   3   4   5
Bog'liq
Py-Slides-111

Script Mode Programming :

  • Script Mode Programming :
  • Invoking the interpreter with a script parameter begins execution of the script and continues until the script is finished. When the script is finished, the interpreter is no longer active.
  • For example, put the following in one test.py, and run,
  • print "Hello, Python!";
  • print "I love COMP3050!";
  • The output will be:
  • Hello, Python!
  • I love COMP3050!

Python Identifiers:

  • A Python identifier is a name used to identify a variable, function, class, module, or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9).
  • Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language. Thus Manpower and manpower are two different identifiers in Python.

Python Identifiers (cont’d)

  • Here are following identifier naming convention for Python:
    • Class names start with an uppercase letter and all other identifiers with a lowercase letter.
    • Starting an identifier with a single leading underscore indicates by convention that the identifier is meant to be private.
    • Starting an identifier with two leading underscores indicates a strongly private identifier.
    • If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.

Reserved Words:

  • and
  • exec
  • not
  • assert
  • finally
  • or
  • break
  • for
  • pass
  • class
  • from
  • print
  • continue
  • global
  • raise
  • def
  • if
  • return
  • del
  • import
  • try
  • elif
  • in
  • while
  • else
  • is
  • with
  • except
  • lambda
  • yield
  • Keywords contain lowercase letters only.

Download 374 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling