Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

CºÍPython³ÌÐòÔ±µÄJavaScriptѧϰָÄÏ£¨Ò룩


write by ¾ÅÌìÑãôá(JTianLing) -- blog.csdn.net/vagrxie
ÌÖÂÛÐÂÎÅ×é¼°Îļþ
 Ô­ÎÄÀ´×Ô£º¡¶JavaScript for C & Python programmers
¡·£¬¾­¹ý×÷ÕßCanisÔÊÐíºó·­Ò룬¼´Ê¹×ªÔØÇ븽´ø´ËÁ´½Ó¡£

ǰÑÔ£ººÜÉٸɷ­ÒëµÄÊÂÇ飬ÀÛ£¬ÐÁ¿à£¬²»ÄÜ·¢»Ó£¬µäÐ͵ķÑÁ¦²»Ìֺã¬×î½üÎÞÁÄ£¬ÏëÔÚÍøÒ³ÉÏÏÔʾ¶¯»­£¨ÒòΪCSDNÌ ......

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') ......

¡¾zz¡¿Python³£ÓÃ×ÊÔ´ÍøÖ·

zz from ¡¶¿É°®µÄPython¡·
http://www.woodpecker.org.cn/
Python±ê×¼¿â http://www.woodpecker.org.cn:9081/doc/Python/_html/PythonStandardLib/
¼òÃ÷Python½Ì³Ì http://www.woodpecker.org.cn:9081/doc/abyteofpython_cn/chinese/index.html
Python¿ìËÙ½éÉÜ http://www.zoomquiet.org/share/s5/intropy/070322-intro ......

python Ö® pilÉú³ÉÑéÖ¤ÂëͼƬ

#!/usr/bin/python
#coding=utf-8
import Image,ImageDraw,ImageFont,os,string,random,ImageFilter
def initChars():
"""
ÔÊÐíµÄ×Ö·û¼¯ºÏ£¬³õʼ¼¯ºÏΪÊý×Ö¡¢´óСд×Öĸ
usage: initChars()
param: None
return: list
·µ»ØÔÊÐíµÄ×Ö·û¼¯ºÍ
for: picCheckerÀà³õʼ×Ö·û¼¯ºÏ
todo: ......

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ºÅ