the p- ython advantages and disadvantages:
Python's advantages are many, simple can be summarized as follows.
-
Simple and clear, do one thing only one way.
-
Low learning curve compared with many other languages, Python is easier to use.
-
Open source, has a strong community and ecosystem.
-
Interpreted language, inherently platform portability.
-
It supports two mainstream programming paradigm (object-oriented programming and functional programming) have provided support.
-
Scalability and embeddable can be called C / C ++ code can also call Python in C / C ++ in.
-
High degree of standardized codes, readable, there are codes for obsessive compulsive disorder and crowd.
Python shortcomings mainly in the following points.
-
Slightly lower efficiency and therefore computationally intensive tasks can be written in C / C ++.
-
Code can not be encrypted, but now many companies are not selling software, but selling services, the issue will be diluted.
-
Too many in the development framework that can be selected (such as Web framework there are more than 100), have a choice where there is an error.
Under Windows environment to build:
and c language python, java language more different, but the most simple. If you learned C language with java man, as far as possible when writing python will have become accustomed to the C language and writing java try to forget, or back often wrong when writing the python.
The first python program:
Experience with python painting:
Use python to write a simple addition and subtraction, multiplication and division:
python enter a name, and then output ...... You're ugly
写出一个用*号组成的正方形
课后作业:
1题
c=float(input("请输入摄氏度:")) f=(9/5)*c+32 print("%d 摄氏度是%d 华氏度" %(c,f))
2题
import math r,h=map(float,input("请输入圆柱的底面半径与高:").split()) area=r*r*math.pi volume=area*h print("底面积为:%.4f" %(area)) print("体积为:%.1f" %(volume))
3题
feet=float(input("请输入英尺数:")) print("%d英尺等于%.4f米"%(feet,feet*0.305) )
4题
M=float(input("请输入水量:")) it=float(input("请输入初始温度:")) ft=float(input("请输入最终温度:")) Q=M*(ft-it)*4184 print("所需要的热量为:%.1f"%(Q))
5题
balance,interest_rate=map(float,input("请输入差额和年利率: ").split()) rate=balance*(interest_rate/12000) print("利息为:%.5f"%(rate))
6题
v0,v1,t=map(float,input("请输入v0,v1和t:").split(",")) a=(v1-v0)/t print("加速度为: %.4f"%(a))
7题
money=float(input("每月存入钱数:")) for i in range(6): s=money*(1+0.00417) money=100+s print("第六月账户钱数: %.3f"%s)
8题
n=int(input("请输入一个0-1000的整数")) baiwei=int(n//10/10) shiwei=n//10%10 gewei=n%10 print("输入数字各位之和为: %d"%(baiwei+shiwei+gewei))