On Python Learning
- In the contemporary world, Python is the most popular programming language in the world, and it is
elegant, simple and clear. Therefore, Python Learning has gained great popular. Base on a survey, a
majority of international organizations and firms acknowledge that they prefer recruiting employees
who can use python expertly.
-However,a host of python learners may have a variety of difficulties and trouble in learning. For instance,a large number of learners fine it difficult to memorize keywords and understand rules of programming. Frequently,it is difficult for them to do sth.
-Then,How to get a good command of this language. I am convinced that practice makes perfect.Only practice can help me to remember keywords and master programming knowledge. I deem that if I try my utmost to practice python every day,the future of Python learning will be helpful and promising.
# -*- coding: utf-8 -*-
# -*- Python study notes -*-
import math
def essential_python_knowledge():
print 'In the contemporary,Python is the most popular pragramming language in the word and thus,'
print 'It\'s of great significance for youngsters to learn Python language well'
print u'''mean n.意义 v.打算 adj.吝啬的
means n.方式,方法
meaning n.意义
meaningful n.重要的
meaness n.吝啬'''
def essential_table():
L = ['view','review','preview','interview','interviewer','interviewee','overview']
Tuple1 = ('professor','professional','amateur','prefession','unprofessional')
Tuple2 = ('just','justice','justify','judge',['adjust','adjustment','injure','injury','jure?'])
dict = {'duce' : 0,'induce' : 1,'reduce' : 1,'produce' : 1,'conduct' : 1,'eaducate' : 1}
s = set(['age','aging','village','cottage','luggage','biggage','storage','voyage','beverage','garage','engage'])
last_Tuple2 = Tuple2[-1]
last_Tuple2[-1] = 'jury'
s.remove('age')
s.add('postage')
print L,u'view n.观点,看法 v.视为,看做'
print Tuple1,u'pro 向前'
print Tuple1[0],u'教授',u'aggression 有侵略性的 disrupting 破坏的 nation 民族 national 民族的 edit 编辑'
print Tuple2
L.append('just')
L.insert(0,'just')
L.pop(0)
print L
sum = 0
for value in dict.itervalues():
sum += value
print dict,sum
print s
def elect_table():
L1 = ['Don\'t','judge a book','by its cover','Don\'t','be so mean']
s1 = range(1,101,2)
print L1[:-2]
print L1[-2:]
print s1[-10:]
def math_problem():
sum1 = 0.0
for i in range(1,101):
sum1 += i
sum2 = 0.0
number1 = 2
while(True):
sum2 += number1
number1 += 2
if number1 > 100:
break
n = 5
print '1+...+100 =',sum1,u'100以内偶数相加:2+4+...+100 = ',sum2,'1*...*%s =' %n,add_fact()
print u'平均函数取值:',average_num(1,2,3,4,5)
def add_fact(n=5):
if n == 1:
return 1
else:
return n*add_fact(n-1)
def average_num(*args):
sum = 0.0
if len(args) == 0:
return 0
else:
for num in args:
sum += num
return sum / len(args)
essential_python_knowledge()
essential_table()
elect_table()
math_problem()