python 叁--函数,获取用户输入

来源:互联网 发布:.net 微商城源码 编辑:程序博客网 时间:2024/05/16 12:45
>>> input("the meaning of life:")the meaning of life:2323>>> x = input ("x : ")x : 23>>> y = input ("y : ")y : 21>>> print x * y483>>> 
>>> if 1 == 2 : print "One equals two">>> if 1 == 1 : print "One equals one"One equals one>>> 

函数


>>> 2 ** 38
调用内建函数pow
>>> pow (2,3)8

>>> 10 + pow (2,2*3) / 3.031.333333333333332
>>> abs (-199)199>>> 1/20>>> round(1.0/2.0)#round函数把浮点数四舍五入为最接近的整数值1.0>>> 

一个人的年龄是22。9,她年龄还没到23,只是取22,则需要floor函数

原创粉丝点击