Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¡¾Python¡¿ÓÃPythonÀ´ÊµÏÖ´Õ24µÄ³ÌÐò

´Õ24ÊǾ­µäµÄÒæÖÇÓÎÏ·£¬¶àÍæ¿ÉÒÔʹÄÔ½îÁé»îÒ»µã£¬µ«Êǵ±Óöµ½ÎÞ½âµÄʱºò£¬¾Í»áºÜÉËÄԽΪ´Ë£¬Ð´¸ö³ÌÐòÀ´´úΪ¼ÆËã¡£
ÔËÐнá¹û£¬È¥³ýÁËÖØ¸´µÄһЩ±í´ïʽ£º
entry: 1
entry: 4
entry: 5
entry: 6
(4/(1-(5/6))) = 24
(6/((5/4)-1)) = 24
Press any key to exit...
entry: 3
entry: 3
entry: 8
entry: 8
(8/(3-(8/3))) = 24
Press any key to exit...
¸½Ô´Â룺
NUMBER=4
TOTAL=24
class data:
pass
def Simplify(a, b):
desta=a;destb=b
if b==0 or b==1:return desta, destb
if a==0 or a==1:return desta, destb
if a>b:n=b
else:n=a
for i in range(2,n+1):
while n != i:
if a%i==0 and b%i==0:
a=a/i;b=b/i;n=n/i
else:break
if a%n==0 and b%n==0:
a=a/n;b=b/n
desta=a;destb=b
return desta, destb
def MergeList(L1, L2):
LSum=[]
if L1==[]:
for i in range(len(L2)):
LSum.append(L2[i])
return LSum
if L2==[]:
for i in range(len(L1)):
LSum.append(L1[i])
return LSum
#fenmu:denominator fenzi:numerator
#L:0 fenzi 1 fenmu 2 format
for i in range(len(L1)):
for j in range(len(L2)):
#+
tempa=L1[i].a * L2[j].b + L1[i].b * L2[j].a
tempb=L1[i].b * L2[j].b
tempobj=data()
tempobj.a, tempobj.b = Simplify(tempa, tempb)
if tempobj.a == 0:tempobj.b=1
tempobj.c = "(%s+%s)" % (L1[i].c, L2[j].c)
LSum.append(tempobj)
#-
tempa=abs(L1[i].a * L2[j].b - L1[i].b * L2[j].a)
tempb=L1[i].b * L2[j].b
tempobj=data()
tempobj.a, tempobj.b = Simplify(tempa, tempb)
if tempobj.a == 0:tempobj.b=1
if L1[i].a * L2[j].b > L1[i].b * L2[j].a:
tempobj.c = "(%s-%s)" % (L1[i].c, L2[j].c)
else:tempobj.c = "(%s-%s)" % (L2[j].c, L1[i].c)
LSum.append(tempobj)
#*
tempa


Ïà¹ØÎĵµ£º

python±àÂëÎÊÌâºÍi18n

ת×Ô http://www.javaeye.com/topic/66558
³õѧPython,Óöµ½ºÜ¶à±àÂëÎÊÌ⣬¼ÇÏÂÀ´ÒÔÃ⽫À´ÓÖÍüÁË£¬ºÜ¶à¶«Î÷²»¶®£¬¶¼ÊÇÊôÓÚ²»ÇóÉõ½â£¬ÂÒϽáÂÛ£¬µ«Ïëµ½ÄóöÀ´¿ÉÒÔÓÐÈÈÐÄͬѧָ³ö´íÎóËùÔÚ£¬±ãºñÆðÁ³Æ¤ÁË……
Ê×ÏÈÐèÒªÁ˽âPythonÖÐÓÐÁ½ÖÖ×Ö·û´®(ÑϸñµØËµ,ËÆºõ²»ÄÜÕâô½Ð)¡£Ò»ÖÖÊÇÆÕͨµÄstr¶ÔÏó£¨Ã¿¸ö×Ö·ûÓÃ8bits± ......

ÅäÖÃvim Ìá¸ß±àдpython½Å±¾µÄЧÂÊ

ʹÓÃpython.vimʹpython´úÂë¸ßÁÁ
http://www.vim.org/scripts/script.php?script_id=790
ʹÓÃ
Pydiction²å¼þʹvimÔö¼Ótab´úÂëÌáʾ¹¦ÄÜ
http://www.vim.org/scripts/script.php?script_id=850
¾ßÌå°²×°·½·¨¿ÉÒÔ²ÎÕÕ°ïÖú»òÕßREADME£¬ÒòΪ°æ±¾±ä»¯»áµ¼Ö°²×°·½·¨ÉϲúÉú²îÒì
±à¼­~/.vimrcÎļþÔö¼ÓÏÂÃæÑ¡Ïî
set nu Ôö¼ÓÐÐ ......

Python ÓÎÏ·³õѧ

import sys, pygame, time
size = width, height = 700,700
fontColor = (0,0,255)
class walk:
'''This is a game about war.
Just like war 3.'''
def __init__(self):
'''Init the screen.
Get param and init the screen'''

#print ('this is init funnction') ......

pythonÖÐÀàµÄÊôÐÔ

pythonÖÐÀàµÄÊôÐÔ
pythonÖеÄÀà½Ðclass object,ÀàµÄʵÀý½Ðinstance object.
Àà Class Objects
ÀàÓµÓÐÁ½ÖÖ²Ù×÷,1.ÀàÊôÐÔ attribute references 2.ʵÀý»¯instantiation
1.ÀàÊôÐÔ¾ÍÏ൱ÓÚרÊôÓÚÒ»¸öÀàµÄ±äÁ¿(¼´Ä³Ð©ÓïÑÔÖеÄÀàµÄ¾²Ì¬¹«¹²±äÁ¿static public),ʹÓ÷½·¨ÊÇ:ÀàÃû³Æ.ÀàÊôÐÔÃû³Æ
2.ʵÀý»¯ÔòÊÇ´´½¨Ò»¸öÀàµÄʵÀýµÄ· ......

beginning python summary chapter 2 ÁбíºÍÔª×é

1¡¢ÔÚPythonÖÐ×î»ù±¾µÄÊý¾Ý½á¹¹ÊÇÐòÁУ¨sequence£©£¬ÐòÁÐÖеÄÿ¸öÔªËØ±»·ÖÅäÒ»¸öÊý×Ö——ÔªËØµÄλÖã¬Ò²½ÐË÷Òý¡£µÚÒ»¸öË÷ÒýÊÇ    0£¬µÚ¶þ¸öË÷ÒýÊÇ1£¬Èç´ËµÝÍÆ¡£ÐòÁÐÖеÄ×îºóÒ»¸öÌõÄ¿±»±ê¼ÇΪ-1£¬µ¹ÊýµÚ¶þÊÇ-2£¬Èç´ËµÝÍÆ¡£
2¡¢ÐòÁУºeg:edward = ['Edward Gumby', 42]£¬ÐòÁÐÒ²Äܰüº¬ÆäËûµÄÐòÁС£Ð ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ