All Samples(197487) | Call(197482) | Derive(0) | Import(5)
range([start,] stop[, step]) -> list of integers Return a list containing an arithmetic progression of integers. range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0. When step is given, it specifies the increment (or decrement). For example, range(4) returns [0, 1, 2, 3]. The end point is omitted! These are exactly the valid indices for a list of 4 elements.
src/x/l/xlwt-0.7.4/xlwt/examples/merged.py xlwt(Download)
ws2 = wb.add_sheet('sheet2')
for i in range(0, 0x200, 2):
ws0.write_merge(i, i+1, 1, 5, 'test %d' % i, style)
ws1.write_merge(i, i, 1, 7, 'test %d' % i, style)
src/p/u/PuLP-1.5.3/examples/BeerDistributionProblem_resolve.py PuLP(Download)
# The problem data is written to an .lp file
prob.writeLP("BeerDistributionProblem.lp")
for demand in range(500, 601, 10):
# reoptimise the problem by increasing demand at bar '1'
# note the constant is stored as the LHS constant not the RHS of the constraint
src/p/y/py_examples-HEAD/phonon/kakawana-read-only/src/kakawana/main.py py_examples(Download)
if fitem._id in (-1,-2):
return
for i in range(fitem.childCount()):
_id=fitem.child(i)._id
if _id:
'''
fitem = self.findFeedItem(post.feed.xmlurl)
for i in range(fitem.childCount()):
if fitem.child(i)._id == post._id:
return fitem.child(i)
return None
def findFeedItem(self, feed_id):
for i in range(self.ui.feeds.topLevelItemCount()):
items = {}
for i in range(item.childCount()):
items[item.child(i)._id]=item
if self.showAllPosts:
src/s/t/STEPS-1.3.0/examples/tutorial/well_mixed.py STEPS(Download)
res = numpy.zeros([2001,3])
for t in range(0,2001):
sim.run(tpnt[t])
res[t,0] = sim.getCompCount('comp', 'molA')
tpnt = numpy.arange(0.0, 2.001, 0.001)
for i in range(0,NITER):
sim.reset()
sim.setCompConc('comp', 'molA', 31.4e-6)
sim.setCompConc('comp', 'molB', 22.3e-6)
for t in range(0,2001):
plotres(res_mean)
for i in range(NITER):
sim.reset()
sim.setCompConc('comp', 'molA', 31.4e-6)
sim.setCompConc('comp', 'molB', 22.3e-6)
for t in range(0,1001):
src/m/y/Myrmidon-HEAD/examples/simple_engine_test/test.py Myrmidon(Download)
amount = 20.0
for c in range(_range):
if type:
self.cur2 -= amount
src/c/a/casadi-HEAD/trunk/examples/python/vdp_collocation.py casadi(Download)
# All collocation time points
T = NP.zeros((nk,d+1))
for k in range(nk):
for j in range(d+1):
T[k,j] = h*(k + tau_root[j])
# For all collocation points
for j in range(d+1):
# Construct Lagrange polynomials to get the polynomial basis at the collocation point
L = 1
for r in range(d+1):
if r != j:
L *= (tau-tau_root[r])/(tau_root[j]-tau_root[r])
# Evaluate the time derivative of the polynomial at all collocation points to get the coefficients of the continuity equation
for r in range(d+1):
lfcn.setInput(tau_root[r])
lfcn.setFwdSeed(1.0)
src/p/y/PyProp-HEAD/examples/tensor/helium_stabilization/plots.py PyProp(Download)
def MakePlotsStabilizationFreq5ScanDoubleIonizationDPDE():
for i in range(36):
E0, E, dpde = FromFileCalculateDoubleIonizationDPDE("output/stabilization_freq5_scan.h5", i)
clf()
pcolormesh(E, E, dpde, vmax=0.2)
def MakePlotsStabilizationFreq5ScanDoubleIonizationDPDELog():
for i in range(10,11):
E0, E, dpde = FromFileCalculateDoubleIonizationDPDE("output/stabilization_freq5_scan.h5", i)
clf()
pcolormesh(E, E, log(dpde), vmin=-7)
rGridLines = linspace(0, maxValDpDomega, 5)[1:-1] rgrids(rGridLines, ["" for p in rGridLines]) thetagrids(range(0,360,45), [r"%s$^\circ$" % t for t in range(0,360,45)]) #put arrow indicating direction of other electron
dpdomega_double = numpy.zeros((numTheta, numTheta)) for i in range(numTheta): for j in range(numTheta): #flatten to make indices from find work
src/r/a/Rabbyt-0.8.3/examples/extend_modes.py Rabbyt(Download)
sprites = [rabbyt.Sprite(x=x) for x in range(-100, 100, 50)] # Constant is the default extend mode. It will not go beyond start or end.
src/m/o/motionless-HEAD/examples/gpolyencode.py motionless(Download)
self._zoom_level_breaks = []
for i in range(num_levels):
self._zoom_level_breaks.append(threshold * (zoom_factor ** (num_levels - i - 1)))
max_dist = 0
for i in range(current[0]+1, current[1]):
temp = self._distance(points[i], points[current[0]], points[current[1]])
if temp > max_dist:
src/p/y/pyutilib.workflow-3.4/doc/workflow/examples/example5.py pyutilib.workflow(Download)
D = TaskD()
for i in range(100):
E = TaskE()
D.inputs.x = E.outputs.Z
Previous 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next