I have multiple questions and have found myself quite lost in python.
Questions:
How do I compare three list? (would it be a similar to "for x in y")
Example:
list1 = [1,2,3] list2 = [a,b,c] list3 = [aa,bb,cc] OUTPUT:
[1,a,aa] [2,b,bb] [3,c,cc] I am working on creating a simulation for a race, 1=vehicle , a=driver , aa= sponsor I have been given a formula, odometer_miles = odometer_miles + speed * time and a cap of 500 miles before a winner is selected. I have come up with a skeleton:
import random class Car(): def __init__(self): self.__name = [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T] self.__sponsor = [aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt] self.__vehicle = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] def __str__(self): (when cap of 500 miles is reached) print "winner", driver,sponsor,vehicle def odometer(self): speed = random.randrange(1, 180) time = 60 odometer_miles = speed * time def main(): main() I posted the code looking for guidance, My question is; have I structured my code correctly in python to get me intended results. What guts would be the most proficient in this instance.
I am using Python-3.x