<jupyter_start><jupyter_text>$e^{i\pi}+1=0$ akskl<jupyter_code>%matplotlib qt4
import pylab as pl
pl.seed(1)
data = pl.randn(100)
pi.plot(data)
%matplotlib qt4
pl.plot(data)
print"Hello World"
print'100 + 300 =',100+300
name=raw_input()
name
print'Hello 'name
print'Hello',name
print '''line1
line 2
line 3
line 4
line 5'''

3>2
print '中文'
# -*- coding: utf-8 -*-
name=raw_input('输入')

# -*- coding: utf-8 -*-
name=raw_input(u'输入')
#coding: utf-8  
  
n=raw_input(unicode('请输入文字','utf-8').encode('gbk'))  
print n
classmates=['m','l','n']
classmates
classmates.append('h')
classmates
t=(1,2,3)
t
t=(1)
t
t=(1,)
t
a=['m','u']
a
a.append('m')
a
age=20
if age>18:
    print'age:',age
    print'adult'
names=['a','b','c']
for name in names:
    print(name)
a=list(range(5))
print a
d={'a':95,'b':94,'c':93}
print d
print d['a']
def my_abs(x):
    if x>=0:
        return x
    else:
        return -x
my_abs(-50)
def calc(*numbers):
    sum=0
    for number in numbers:
        sum=sum+number*number
    return sum
calc(1,2,3)
calc(*[1,2,3])
num=[1,2,3]
calc(*num)
def person(name,age,**kw):
    print 'name:',name,'age:',age,'other:',kw
person('MiShuo',23)
person('M',23,city='Liaocheng')
person('M',23,haha='Liaocheng')
def fact(n):
    if n==1:
        return n
    return n*fact(n-1)
fact(5)
l=[]
l=range(1,10,2)
l
L=['m','l','n']
L[0:3]
L[1:3]
L=range(100)
L[:10]
L[-10:]
'ABCDEFG'[:3]
d={'a':1,'b':2,'c':3}
for key in d:
    print key
for v in d.itervalues():
    print v
for k,v in d.iteritems():
    print k,v
for ch in'ABCDERF':
    print ch
from collections import Iterable
isinstance('ABC',Iterable)
range(1,11)
[x*x for x in range(1,11)]
[x*x for x in range(1,11) if x%2==0]
[m+n for m in 'ABC' for n in 'XYZ']
d={'x':'A','y':'B','z':'C'}
[k+'='+v for k,v in d.iteritems()]
L=['A','B','C']
[ss.lower() for ss in L]
L=['A','B',23,'C']
[s.lower( ) for s in L if isinstance(s,str)]
g=(x*x for x in range(10))
g
g.next()
g.next()
gg=(x*x for x in range(10))
for n in gg:
    print n
def fib(max):
    n,a,b=0,0,1
    while n<max:
        yield b
        a,b,n=b,a+b,n+1
fib(6)
for f in fib(6):
    print f
def f(x):
    return x*x
map(f,[1,2,3,4,5,6,7,8,9])
def str2int(s):
    def fn(x,y):
        return x*10+y
    def chr2num(s):
        return {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9}[s]
    return reduce(fn,map(chr2num,s))
str2int('121312')
def chr2num(s):
        return {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9}[s]
chr2num('0')
def is_mod(s):
    return s%2==1
filter(is_mod,range(11))
sorted([1,5,9,8,6,8,44,3,2,1])
def calc_sum(*args):
    ax=0
    for n in args:
        ax=ax+n
    return ax
calc_sum(1,2,3,4,5)
def lazy_sum(*args):
    def sum():
        ax=0
        for n in args:
            ax=ax+n
        return ax
    return sum
f=lazy_sum(1,2,3,4,5)
f()
f1,f2,f3=[3,4,5]
f1
def count():
        for i in range(1, 4):
            def f():
                return i * i
            yield f
            
        
def count():
    fs = []
    for i in range(1, 4):
        fss[n]=i
        def f():
             return fss[n]*fss[n]
        fs.append(f)
    return fs

f1, f2, f3 = count()
 f1()
fa=[1,2,3]
fa[1]
fa[2]=100
fa
def count():
    fs = []
    for i in range(1, 4):
        def f(j=i):
             return j*j
        fs.append(f)
    return fs

f1, f2, f3 = count()
f1(),f2(),f3()
map(lambda x:x*x ,[1,2,3,4,5,6])
def now():
    print '2017/8/8'
f=now
f()
 now.__name__
f.__name__
#!/usr/bin/env python
# -*- coding: utf-8 -*-

' a test module '

__author__ = '<NAME>'

import sys

def test():
    args = sys.argv
    if len(args)==1:
        print 'Hello, world!'
    elif len(args)==2:
        print 'Hello, %s!' % args[1]
    else:
        print 'Too many arguments!'

if __name__=='__main__':
    test()
class Student(object):
    
    def _init_(self, name, score):
        self.name = name
        self.score = score
        
    def print_score(self):
        print '%s: %s' % (self.name, self.score)
print a 
print '%s' %a
#要注意，类calss的名称首字母要大些，__init__的下划线是两个_
class Student(object):
    
    def __init__(self, name, score):
        self.name = name
        self.score = score
        
    def print_score(self):
        print '%s: %s' % (self.name, self.score)
        #print self.name, self.score
bart = Student('<NAME>', 59)
bart.print_score()
bart.name
 bart = Student('<NAME>', 59)
lisa = Student('<NAME>', 87)
bart.age=8
bart.age
bart.aaa=9
bart.aaa
bart.aA='AAS'
bart.aA
from matplotlib import pyplot
import numpy
%matplotlib inline
from matplotlib import rcParams
rcParams['font.family'] = 'serif'
rcParams['font.size'] = 16
from IPython.core.display import HTML
css_file = 'styles/numericalmoocstyle.css'
HTML(open(css_file, "r").read())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2080706179066835, 'fraction_numerical': 0.054434636401849514, 'mean_word_length': 3.1418624891209745, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '100069', 'license': 'MIT', 'n_tokens_mistral': 2187, 'n_tokens_neox': 2113, 'n_words': 482, 'path': 'notebook/train.ipynb', 'repo_name': 'MedievalSure/ToStudy', 'size': '4782'}