Python练习2->Get Abs

时间:2015-05-30 13:25:47   收藏:0   阅读:224
1 def my_abs(x):
2     if x>=0:
3         return x
4     else:
5         return -x
6 
7 z=int(raw_input("Please Input The Number You Want To Get Abs:  "))
8 y=my_abs(z)
9 print y

 

原文:http://www.cnblogs.com/Curious-Python/p/4540141.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!