-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·83 lines (54 loc) · 955 Bytes
/
test.py
File metadata and controls
executable file
·83 lines (54 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/python
for line in open("test.txt"):
if "main" in line:
print line.rstrip()
print "end open text.txt"
# use print
print 'test python!'
# use x and y
x = 2
y = 3
print x * 3
# import math lib
import math
print math.pi
z = math.pi
m = z * z
print z
print str(z)
print len(str(z))
# use for and range
for i in range(0, 10):
print i
# use break
print 'break test'
for i in range(10):
if i <= 5:
print i;
else:
print 'break'
break
a = int(raw_input("input a:"))
b = int(raw_input("input b:"))
print a + b
print a * b
print a % b
print a / b
print a % b
# define function
# document function
def add(a, b):
'''my function name: add(a, b)
use test
new test2 doc'''
if True :
print a + b
else:
print a - b
print ''' test add(a, b) '''
print add(2, 3)
# use .__doc__
print add.__doc__
print '''test help(add)'''
# use help function
help(add)