What is Python? High level programming language

Python is a high-level universal language that can be extended and integrated. He, for example, is included in the application package as a tool for writing macros. This makes Python a smart choice for many programming tasks, large and not very, and not so good for a small number of computational tasks.

Where is better to use?

Python is ideal for projects requiring rapid development. It supports several programming paradigms, which is good for programs that require flexibility. And the presence of many packages and modules provides versatility and saves time.

– Python, « ». 1980- , , . .

python what is it




, . , , .





Python .

Python . . . , C { } – . ​​ , , , Python. ? , , . .

, , . , , , . . , Python , , , . . , , , , .

python language




. , . , . Python . , .

















, , , , C ++, . , , , . .

, Python . , ( Java), , C.

Python 1989 ., . 1991 ., Usenet.

python programming




Python

Python, . Python 2.7 Python 3.5 , - , , .

«» , . Windows Python. python.org.

, Python, , , , .

, , () . Python. , . .

IDLE , . Python .

python for beginners




, , . :

  • ;
  • , Python;
  • .

, . .

, . , . Python .

Python , , >>>.

.

Python , , .

. , .

  • >>> print ", !"
  • , !

! Python , .

python examples




:

  • ( ) ;
  • print ( ) Enter.

.

( , ) :

  • >>> = [3,2]
  • >>>
  • [3, 2]
  • >>> print
  • [3, 2]

«print » , . , – :

  • >>> x = "MyString"
  • >>>
  • "MyString"
  • >>> print
  • MyString

(, , ), , .

Message

:

  • >>> class Message:
  • ... pass
  • ...
  • >>> Message
  • <class ___ main ___. Message at 0x58db0>
  • >>> print Message
  • __main __. Message

Python . ('), (") (''' """) . x:

  • >>> x = "MyString"

Python . . . , . , , - (.), :

  • >>> x.lower ()
  • "mystring"

s[i]. , s [0] , s [1] , :

  • >>> x[0]
  • 'm'
  • >>> x[1]
  • 'y'

, "". :

  • (capitalize, upper, lower, swapcase, title);
  • (count);
  • (encode, decode);
  • (find, replace, rfind, index, rindex, translate);
  • (startswith, endswith, isalnum, isalpha, isdigit, islower, isspace, istitle, isupper);
  • (join, partition, rpartition, split, splitlines);
  • (center, ljust, lstrip, rstring, rjust, strip, zfill, expandtabs).

python 2 7




Python:

Python , - . , . , , . , , Python. , – :

  • >>> bases = ['A', 'C', 'G', 'T']
  • >>> bases
  • ['A', 'C', 'G', 'T']
  • >>> bases.append('U')
  • >>> bases
  • ['A', 'C', 'G', 'T', 'U']
  • >>> bases.reverse()
  • >>> bases
  • ['U', 'T', 'G', 'C', 'A']
  • >>> bases[0]
  • 'U'
  • >>> bases[1]
  • 'T'
  • >>> bases.remove('U')
  • >>> bases
  • ['T', 'G', 'C', 'A']
  • >>> bases.sort()
  • >>> bases
  • ['A', 'C', 'G', 'T']

. , , , 'U' . , remove() , , .

, remove(), Python , . , .

Python:

. Python. :

  • len() – ;
  • dir() – , ;
  • list() – , - .
  • >>> help(round)
  • Help on built-in function round:
  • round(...)
  • round(number[, ndigits]) -> floating point number

.

python functions




,

Python- . def, ( ), , . . , . :

  • >>> def transcribe(dna):
  • ... """Return dna string as rna string."""
  • ... return dna.replace('T', 'U')
  • ...
  • >>> transcribe('CCGGAAGAGCTTACTTAG')
  • 'CCGGAAGAGCUUACUUAG'

transcribe, , . replace() . . :

  • >>> def reverse(s):
  • ... """Return the sequence string in reverse order."""
  • ... letters = list(s)
  • ... letters.reverse()
  • ... return ''.join(letters)
  • ...
  • >>> reverse('CCGGAAGAGCTTACTTAG')
  • 'GATTCATTCGAGAAGGCC'

reverse , , , . . join (), , . , , ('' "").

Python - ? , . (), (). -. . , .

  • >>> basecomplement = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
  • >>> basecomplement.keys()
  • ['A', 'C', 'T', 'G']
  • >>> basecomplement.values()
  • ['T', 'G', 'A', 'C']
  • >>> basecomplement['A']
  • 'T'

, , . Python class, . , , .

, , Python. ? :

  • . , Paint Shop Pro 8 .
  • Python , .
  • , , .
  • .
  • Python .




All Articles