随笔分类 -  python

Problem Set 1 b
摘要:#Problem 2. #Write a program that computes the sum of the logarithms of all #the primes from 2 to some number n, #and print out the sum of the logs of the primes, #the number n, and the ratio of these two quantities. #Test this for different values of n. #You should be able to make only some small c 阅读全文

posted @ 2012-06-23 18:30 X.P.Chen 阅读(170) 评论(0) 推荐(0)

python求第1000个素数
摘要:#Problem Set 1 #Name: Jeff Chen #Description:Write a program that computes and prints the 1000th prime number. #Date:2012-6-22 from math import * i=0 for num in range(1,10000): isprime=True for j in range(2,int(sqrt(num))+1): if num%j==0&num!=j: isprime=False ... 阅读全文

posted @ 2012-06-23 12:37 X.P.Chen 阅读(326) 评论(0) 推荐(0)

My first Python class
摘要:""" This is a student class, it has functions:study(),Getage,Getname,Getschool and ageSet, nameSet,schoolSet. @author Jeff Chen @date:2012-3-3 """ #a student class class student: #study function def study(self): print '%s read and study'%self.name #set name def 阅读全文

posted @ 2012-03-03 21:45 X.P.Chen 阅读(169) 评论(0) 推荐(0)

导航