lists - ## list_of_locs= [ ] f =...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
from __future__ import division from visual import * ##list_of_words = ['crocodile','rhino','zebra','bison'] ##print list_of_words ##for thisword in list_of_words: ## print 'What color is a', thisword, '?' ## ## ## ## ## ##list_of_evens = [2,4,6,8,10] ##list_of_odds = [1,3,5,7,9] ##for thisnum in list_of_odds: ## print thisnum**2 ## ##list_of_spheres = [sphere(pos=(-9,0,0)), sphere(pos=(9,0,0)), sphere(pos=(0,9,0)), ##sphere(pos=(0,-9,0)), sphere(pos=(0,0,9)), sphere(pos=(0,0,-9))] ##print list_of_spheres ## ##for thisball in list_of_spheres: ## ## rate(1) ## thisball.color=color.blue ## thisball.radius=1 ## thisball.pos = thisball.pos + (1,-1,2) ## print thisball.pos ## ##list_of_boxes= [ ] ##n=0 ##nmax=5 ##while n < nmax: ## rate(1) ## list_of_boxes.append(box(pos=(2*n,0,0))) ## n = n + 1 ## ##list_of_arrows= [ ] ##for thisball in list_of_spheres: ## list_of_arrows.append(arrow(pos=thisball.pos+(1,0,0),axis=(5,0,0)))
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ## list_of_locs= [ ] f = open('balloon_data.txt','r') j=0 jmax=1000 while j &lt; jmax: ## rate(1) ## location = vector(j,j**2,0) ## print 'Location is:', location posx = float(f.read(4)) blank1 = f.read(1) posy = float(f.read(4)) blank2 = f.read(1) posz = float(f.read(4)) blank2 = f.read(1) location = vector(posx,posy,posz) list_of_locs.append(location) j = j + 1 ## ##list_of_displacements= [ ] ##k = 0 ##kmax = 4 ##while k &lt; kmax: ## ## rate(1) ## displacement=list_of_locs[k+1]- list_of_locs[k] ## print 'Displacement is:', displacement ## list_of_displacements.append(displacement) ## arrow(pos=(list_of_locs[k]),axis=(displacement)) ## k = k + 1 t=.247 a = (list_of_locs[822]-list_of_locs[443])/((822-443)*t) b = (list_of_locs[831]-list_of_locs[294])/((831-294)*t) c = (list_of_locs[814]-list_of_locs[274])/((814-274)*t) print b print c...
View Full Document

Page1 / 2

lists - ## list_of_locs= [ ] f =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online