.


:




:

































 

 

 

 





. , # .

, . :

"""

"""

, . , , , .

, # //. , # , .

? Python, , .

, - . , ! , , . Matplotlib, Latex.

/

? - , , , / .

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

Python , , . , , . IPython, , .

- /.

input, :

s=input (', ')

.

:

x=float(s).

print (). , .

if

if <>:

< >

if (. ); ; , ( ), , . else , , if . elif, else: if, .

:

x=2

if x>0:

print ("x ")

elif x<0:

print ("x ")

else:

print ("x=0")

While

while (. ) if:

while < >:

< >

, , . .

s L . .

s="15.678*x+y*(3+2*x^2)"

={'+','-','/','*','(',')','^'}#

L=list()#

s1=""#

while len(s)>0:#

if s[0] in :#

L.append(s1) # s1 L

s1=""#

else:

s1+=s[0] # s1 s[0] - s

s=s[1:] # s

print (L)

:

['15.678', 'x', 'y', '', '3', '2', 'x', '2']

if, while else, , .

, - . :

i=0

while i<10:

print (i)

, .. i < 10 , i : . , , , [Ctrl+C], , (, ), . , . - , , .

, . , . , ! [2]

break continue

while . . break continue. , , . , break .

, . , sin cos. , Python . . , math.

import. .:

import math# math

print (math.cos(math.pi/3))

, :

import numpy as np # numpy np

from :

from math import cos, sin, pi

print (cos(pi/3))

from , .

, :

from math import *

*, , , . . , , , . , cos(),sin() pi numpy, .

Python ( )

/ Tab Shift+Tab.

Python! , , .

.





:


: 2018-10-15; !; : 1304 |


:

:

, .
==> ...

1630 - | 1561 -


© 2015-2024 lektsii.org - -

: 0.013 .