CoCalc Public Filestmp / cool_code.pyOpen with one click!
Authors: Harald Schilly, William A. Stein
1
# My Python library
2
3
import sage.all as sage
4
5
def cool_facts(year):
6
"""
7
This is a docstring....
8
"""
9
print "Prime? ", sage.is_prime(year)
10
print "Number of primes: ", sage.prime_pi(year+1)
11
print "Sum of digits:", sum([int(a) for a in str(year)])
12
if not sage.is_prime(year):
13
print "Factors", sage.factor(year)
14
15
def another_function(n):
16
return n+1