xiti2:
import stdio
import sys
import stdarray
a = []
i = 0
while not stdio.isEmpty():
a += [stdio.readInt()]
i += 1
stdio.writeln(a)
stdio.writeln(max(a))
stdio.writeln(min(a))
xiti10:
过滤器:
import sys
import stdio
#lo = int(sys.argv[1])
#hi = int(sys.argv[2])
i = 0
while not stdio.isEmpty():
value = stdio.readInt()
if(value >= 0) and (value <= 99):
stdio.writef('%-3d',value)
i += 1
if(i % 5 == 0):
stdio.writeln()
主程序:
import stdio
import sys
import random
m = int(sys.argv[1])
n = int(sys.argv[2])
for i in range(n):
#stdio.writef('%2d ',random.randrange(0,m))
stdio.writeln(random.randrange(0,m))
xiti12:
import sys
import stdio
import stdarray
i = 0
ss=' '
N = stdarray.create1D(4,0.0)
A = stdarray.create1D(4,0.0)
H = stdarray.create1D(4,0.0)
while True:
stdio.writeln('What is your name?')
Name = stdio.readString()
N[i] = Name
if(Name == 'NULL'):
break
stdio.writeln('How old are you?')
AGE = stdio.readInt()
A[i] = AGE
stdio.writeln('How tall are you?')
Height = stdio.readInt()
H[i] = Height
i = i+1
t = i
stdio.writef('%-4.4s %-4.3s %-6.6s %-6.6s\n','Name','Age','Height','shuzhi3')
for i in range(t):
format = '%-3s %-4.2d %-4.2d %-4.3f\n'
stdio.writef(format,N[i],A[i],H[i],float(A[i])/float(H[i]))