Skip to content

Commit b9ce01f

Browse files
committed
修为方法
1 parent 67d088a commit b9ce01f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test_myfunction.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
import math
4+
def my_abs(x):
5+
x = int(x)
6+
if x >= 0:
7+
return x
8+
else:
9+
return -x
10+
x = raw_input('plase input a num:')
11+
print x,'的绝对值为', my_abs(x)
12+

0 commit comments

Comments
 (0)