Skip to content

Commit

Permalink
数字
Browse files Browse the repository at this point in the history
  • Loading branch information
罗晟 committed Dec 29, 2014
1 parent f074be3 commit 8f3efa6
Show file tree
Hide file tree
Showing 11 changed files with 721 additions and 3 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/learingPython.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/scopes/scope_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

550 changes: 550 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cluo_bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello
world
60 changes: 60 additions & 0 deletions number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
print 4.0e+2
print 021
print 0x1f
print abs(-77)
print pow(3,2)
print hex(13)
print oct(13)
print bin(13)

if 2 != 3:
print 'not'
if 2 in (2, 3, 4, 6):
print 'yes'
if 2 not in (2, 3, 4, 6):
print 'no'
bCluo = bin(1010)
print bCluo
#print bCluo
#cluocluo = ~bCluo
#print cluocluo
print 3 ** 2
he = [1, 2, 3, 4, 5]
print he[1:3]
print int(3.14)
print float(3)
num = 1/0.333
print num
print '%e' % num

print '%4.2f' % num
print '{0:4.2f}'.format(num)


#floor div

print 10/4.0
print 10//4.0
import math
print math.floor(2.5)
print math.floor(-2.5)

print math.trunc(2.5)
print math.trunc(-2.5)


#int
print 012
print 0x11
print 0b0101
print int('0x40',16)
print int ('0b1101',2);
print int('0x2f',16)
print int ('032',8)

#format
print '{0:o},{1:x},{2:b}'.format(64,64,64)
print '%o, %x, %X' %(64, 255, 255)

#oct 00
print 0012
57 changes: 54 additions & 3 deletions type.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,63 @@
#T.append(4)
#print T

f = open('cluo','w')
f = open('cluo_bb','w')
f.write('Hello\n')
f.write('world\n')
f.close()


f = open('cluo_bb')
content = f.read();
print content
list = content.split()
print list
#dir seek
doc = dir(f)
print doc
help(f.seek)

X = set('spam')
Y = {'h', 'a', 'm'}

print X, Y
#intersection
print X & Y
#union
print X | Y
#diff
print X - Y
list = {x ** 2 for x in [1, 2, 3, 4]}
print list



#decimal fixed precision
import decimal
d = decimal.Decimal('3.141')
print d + 1

#initrialize name obj
X = None
print(X)
L = [None] * 100
print L

print type(L)

#type
# if type(L) == type([]):
# print('yes')
# if type(L) == list:
# print('yes')
# if isinstance(L,list):
# print('yes')
class Worker:
def __int__(self, name, pay):
self.name = name
self.pay = pay
def lastName(self):
return self.name.split()[-1]
def giveRaise(self, percent):
self.pay *= (1.0 + percent)

bob = Worker('bob cluo',5000)
print bob.lastName();

0 comments on commit 8f3efa6

Please sign in to comment.