Python练习2->Get Abs

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

 

posted @ 2015-05-30 11:58  Curious-Python  阅读(176)  评论(0)    收藏  举报