.


:




:

































 

 

 

 





әә.

B AB A V B A&B AÅB A≡B A│B
               
               
               
               

.

  &       V       Å     ┐ not & and V or Å xor
                           
                           

┐┐A AÅA A→A AÅ ┐A A→┐A A→1 A→0
               
               

 

A&A A&ùA AVA AVùA A&0 AV0 A&1 AV1
                 
                 

,

A=AVA=A&A=A&1=AV0=┐┐=AÅ0

┐A= A→┐A= A→0= AÅ1

1=AV1=AVùA= A→1

0=A&ùA=A&0.

B ùAVB =AB A&ùB ùA&ùB=ù(AVB) ùAVùB =ù(A&B) =A|B
           
           
           
           

 

B A&BVùA&ùB = A≡B ùA&BVA&ùB = A≠B = AÅB
       
       
       
       

 

B A&BVùB AVùB
       
       
       
       

B A&BVA&C = A&(BVC) (AVB)&(AVC) = AVB&C
             
             
             
             
             
             
             
             

. ().

B F(A,B,C)= A&B&C V A&B&C V A&B&C -
         
         
        A&B&C V
         
         
         
        A&B&C V
        A&B&C

F(A,B,C).

A&B&C V A&B&C V A&B&C = A& B&C V A& B&C V A&B &C V A&B &C = (AVA)& B&C V A&B &(C V C) = 1&B&C V A&B&1 = B &C V A& B = B &(C V A)

F(A,B,C)= B&(C V A)

:

& and

ù V B not or

A Å B A xor B

1. :

) ùA & B )A & ùB

) ùA V ùB )A V ùB

) ù (A & B) ) ù (ùA & ùB)

) (A & B) V (ùA & ùB) ) ù (A & B) V C & ù B

) ù (A & B) V ù C & ù B ) (ù A & B) V (A & ù B)

) Å B Å B ) A Å B Å B

) A B B ) ùA (ùB & C V (A B))

) ù(A ùB) & C V (A B) ) ù(A ù(B & C) V (A B)

2.

) NOT A; ) NOT_ABC; ) NOT NOT B; ) C NOT V;

) A NOT OR B; ) NOT A XOR B; ) A XOR B ANDC.

3. :

) not not A and (B xor C) )A or true and ùB

) not A and not B or A and B )not (A or not (B or not C))

4.

) (A<B) AND (C<=D) AND not E, A=2, B=3, C=5, D=4, E=FALSE

) A DIV TRUNC(B/(2*C)), A=9, B=26, C=3

) (X*9)-A, X=3.2, A=8.7

) B OR FALSE, B=TRUE

) X MOD 10 + 1, X=11

5. ,
B V A&ùB = B V A.

6. ?

) A|A; A|A|A; A|A|A|A; A|A|A|A|A; A|B; B|A.

) A|B|C; A|(B|C); A|A|B|B|C|C.

) (A B) ; A (B ); A B; B A;

7. ?

) (A&ùB V C)&(ùA V B) = B V A;

) (A V B V C)&(ùA V B) = B V A

8. , (,Ү), ,[1] true, false.

)       )       )    
                     
                     
                     

) )

                   
                   
                   
                   
                   

 

) )

                   
                   
                   
                   
                   

9. , 1, [2], 0.

10. , true, (,Ү)

11. , true, (,Ү) , 1 Ү=X2.

1)

2)

3)

12. .

) , ;

) ,

13. F(x1,x2,x3), 1() :

) 0();

) 1();

) 1() ;

) 0() ;

) 0();

) 1();

14. .

A B F1 F2 F3 F4 F5 F6 F7 F8
                     
                     
                     
                     
                     
                     
                     
                     

15. .

C=A+B, i-

Ai Bi Pi Ci Pi+1
         
         
         
         
         
         
         
         

16. : A:=ÅB; B:=ÅB; A:=ÅB?

, ++ , PYTHON

 

if If-else If-elif If-elif-else
if <>: <> if <>: <1> else: <2>    
  if <1>: <1> else: if <2>: <2> if <1>: <1> elif <2>: <2>  
  if <1>: <1> else: if <2>: <2> else: <3>   if <1>: <1> elif <2>: <2> else: <3>

 

c=max(a,b) :

if a>b then c:=a else c:=b; // Pascal

if (a>b) c=a; else c=b; // ++

Python :

if a>b: c=a

else: c=b

:

= (a if a>b else b)

. . 10100. .

[3]:

x,y,z=map(int,input().split()

if x>=y and y>=z: print(x)

elif y>=z: print(y)

else: print(z)

 

:

x,y,z=map(int,input().split()

print(x if x>=y and y>=z else y if y>=z else z)

, :

print(max(map(int,input().split())))

-

: input()

a = input() b = input() a = int(a) b = int(b) a,b = input().split() a = int(a) b = int(b) a,b = map(int, input().split())

input . , int, a b.

 

: print()

a = 1

b = 2

print(a, +, b, =, a + b)

. : , . print sep, , (sep separator). sep= . sep, ::

print(a, b, sep = :) # 1:2

sep, :

print(a, +, b, =, a + b, sep = ) # 1+2=3

, sep , , :

print(a, b, sep = \n)

, , . \n. , , : \\.

print end, print. end = \n, .. . .

:

print(a, b, sep = ,, end = ) # 1,2 .

Python " '. . , ''!

''!

, """.

. % , %s . . %()s. %()s .

Print "Name: %s \n Number: %s \n String: %s" % (my class.name, 3, 3 * "_")

Name: Poromenos

Number: 3

String: ___

strString = """

"""

print "This %(verb)s a %(noun)s." % {"noun": "test", "verb":"is"}

This is a test.

Python :

(lists). ( );

(tuples). ;

(dictionaries). , . "" , .. , . 0, -1. .

:

spisok = [1, ["", ""], ("a", "")] #: ,

spisok = ["", 2, 3. 14] # : ,

spisok [0] = " " # 1- (0-)

spisok [2] = 3.14 #

slovar = {"Key 1": "San 1", 2: 3, "pi": 3.14}#,

slovar ["pi"] = 3.15 # "pi".

tuplau = (1, 2, 3) #

oznlk = len #

print oznlk (spisok) # 3

 

-, : """ . , .

, . 0. . , .

word=

print(word[4]) #

print(word[0:2]) #

print(word[2:4]) #

Python . :

a='123'

print(a,1, 2, sep='=', end = '\n')

a[0]='0'

print(1, 2)

Traceback (most recent call last):

File "C:/Users/1/PycharmProjects/untitled2/22.py", line 3, in <module>

a[0]='0'

TypeError: 'str' object does not support item assignment

:

0, .

:

b=[1,2,3,4,5,6,7]

a=b[:5] # a=[1,2,3,4,5]

c=b[5:] # c=[6,7];

, ;

. , , 0 . .

:

b=[1,2,3,4,5,6,7]

a=b[:-2] # a=[1,2,3,4,5]

c=b[-2:] # c=[6,7];

 

uHello World! Unicode

 

. % , %s . . %()s. %()s .

Print "Name: %s \n Number: %s \n String: %s" % (my class.name, 3, 3 * "_")

Name: Poromenos

Number: 3

String: ___

strString = """

"""

print "This %(verb)s a %(noun)s." % {"noun": "test", "verb":"is"}

This is a test. , :. , , , . . :

spisok = ["Elem 1", 2, 3.14]

print spisok [:] # ['Elem 1', 2, 3.14]

print spisok [0: 2] # 0- 1- . [' Elem 1', 2]

print spisok [-3:-1] # 0- (-3) 2- (-1) ['Elem 1',2]

print spisok [1:] # 1-, [2, 3.14]

 

:

1. Python (begin..end pascal {..} ), : ( );

2. ;

3. #;

4. """;

5. =;

6. ==;

7. +=;

8. -=. , .

:

a = 1 # 1

a += 2 # 2

a -= 3 # 3

"""

"""

s = " " # s " "

s += " ." # s ""

print s # .

# .

a, s = s, a

range, .

A=list(range(10)) # A=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

A=list(range(2,10)) # A=[2, 3, 4, 5, 6, 7, 8, 9]

A=list(range(1,10,2)) # A=[1, 3, 5, 7, 9]

A=list(range(10,2,-2)) # A=[10, 8, 6, 4]

 

3.4. -

input(), .

:

N=input()

input()

, , split()

a,b,c=input().split() # input().split( )

,, split(,)

, raw_input(), , , .

x = int(raw_input (" :"))

print, .

. , 10100, . , .

1) , [4]

A=int(input())

B=int(input())

print(A+B)

2) .

print(int(input ())+int(input ()))

r=input # input r

print(int(r())+int(r()))

 

print(), .

:

print(N) # .

().

:

print(N, a[N]) .

input()

, , split()

a,b,c=input().split() # input().split( )

,, split(,)

 

inp = open('input.txt', 'r') inp 'input.txt'

out = open('output.txt', 'w') out 'output.txt'

T = int(inp.readline())

out.write(ans + "\n") ans

while, if, for .

while ң .

;

s = n = 0 while s < 43: s += 12 n += 3 print(n) # 48 s n
   

for . <san> range(<san>).

rangelist = range (10) # ( 0 9)

print rangelist #

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

for number in rangelist: # number ...

if number in (3, 4, 7, 9): # number (3, 4, 7, 9)...

break # break

else: # . ,

continue # continue .

pass #

if rangelist [1] == 2:

print " 2"

elif rangelist [1] == 3:

print " 3"

else:

print ""

while rangelist[1] == 1:

pass

;

N=int(input())

K=0

for i in range(N):

x=input()

if x<0:

K+=1

print(K)

3) җ .

a = []

N = 2016

S=0

for i in range(0, N):

a.append(int(input()))

S+=a[i]

print(S / N)

2-

N = 2016

print(sum(map(int,input().split())) / N)

 

def. . , . , .

lambda .

def f (ar1, ar2 = 100, ar3 = "test"):

# ar2 ar3 - , ,

# , .

return arg3, arg2, arg1

1- "Ar 1", 2- , 3- - "Named ar".

r1, r2, r3 = f ("Ar 1", ar3 = "Named ar")

# r1, r2 r3 "Named ar", 100, "Ar 1"

print r1, r2, r3 # Named ar 100 Ar 1

 

# def f(x): return x + 1

fvar = lambda x: x + 1

print fvar (1) # 2

:

def F(n):

if n > 0:

G(n - 1)

def G(n):

print('*')

if n > 1:

F(n - 2)

N= int(input())

print(F(n))

def F(n):

if n < 2: return 1

else: return F(n - 1)+F(n-2)

n=int(input())

print(F(n))

def F(n):

if n < 2: return 1

else: return F(n - 1)* n

n=int(input())

print(F(n))

, , . . Python , .

1:

def F(n):

a=0

b=1

while a<n:

print(a,end= )

a,b=b,a+b

F(50)

:

0 1 1 2 3 5 8 13 21 34

2:

def NOD(a,b):

while a*b>0:

if a>b: a%=b

else: b%=a

print(150,42)

:

6

, , . .

Python , , .

def _(_):

1

2

N

, N:

def f(n)

a=0

b=1

while a<n:

print(a,end= )

a,b=b,a+b

f(50)

:

0 1 1 2 3 5 8 13 21 34

- . , global , Python .

 

n = 5

m = 7

def f():

print(n) # 5

def f1():

# , n

# .

# .

print (n)

n = 3

def f2():

global n

# .

n = 3


 

import [libname], [libname] . from [libname] import [funcname], [funcname] [libname]

random

whrandom

bisect

array

UserString

os

 

Import random # random

From time import clock # clock time

randomint = random.randint (1, 100)

print Randomint # 64

 

Math .

cos(x) x.

log(x) x.

pow(x, y) x**y.

sqrt(x) x.

sin(x) x.

:

pi .

e e.

 

 

sys .

atexit .

types .

operator Python .

traceback traceback.

imp , import.

pprint .

repr repr() .

Sys , , , . sys .

:

Argv , Python

Exit([exit_code]) .

Maxint , int.

Modules , -.

 


 





:


: 2016-12-05; !; : 444 |


:

:

, .
==> ...

1351 - | 1172 -


© 2015-2024 lektsii.org - -

: 0.305 .