Wednesday, August 24, 2016

.py


a=[]
for b in range(1,101):
if b%3==0:
a.append(b)
print a

for a i

n range(1,101):
if a%3==0:
print a


>>> s = "I am, writing\npython\tbook on line"
>>> s
'I am, writing\npython\tbook on line'
>>> print s
I am, writing
python book on line
>>>


>>> a
'bla bla n shit'
>>> a[:]
'bla bla n shit'
>>> a[3:]
' bla n shit'
>>> a[:3]
'bla'


>>> "%s%s"%(a,b)
'arsbuti'
>>> print "%s%s"%(a,b)
arsbuti


>>> a=1
>>> b='2'
>>> c="3"
>>> type(a)
<type 'int'>
>>> type(b)
<type 'str'>
>>> type(c)
<type 'str'>


>>> a="ars"
>>> b=8
>>> a+`b`
'ars8'
>>> a+str(b)
'ars8'
>>> a+repr(b)
'ars8'


>>> b="fuck u"
>>> b
'fuck u'
>>> print b
fuck u
+++
>>> a=1
>>> type(a)
<type 'int'>
>>> b="fuck u"
>>> type(b)
<type 'str'>

>>> a=2
>>> y=3*a+2
>>> y
8
>>> a=3
>>> y
8
+++++++++
>>> y=3*a+2
>>> y
11

help(round)
type(int)
>>> round(1.234)
1.0
>>> round(1.234,2)
1.23

>>> pow(2,3)
8

No comments:

Post a Comment