[Tutor] silly question

Jason Child jasonchild at cnsp.com
Wed Dec 22 21:02:06 CET 2004


I've got a silly question.
#######################
P1 = "prefix1"
P2 = "prefix2"

def my_func(list, items):
    s = 0
    out = ""
    for i in range(len(list)):
        if s == 0:
            p = P1
        else:
            p = P2
        for j in range(len(items)):
            out += p +items[j]
    return out
########################
now what i was expecting was the output to alternate prefixes for each 
item set in list. so:

list = ["set1","set2"]
items = ["car","truke",skateboard"]

would yield:

prefix1carprefix1truckprefix1skateboardprefix2carprefix2truckprefix2skateboard

but i am not getting that. I do feel stupid for this, as I usually have 
an easy time picking up programming languages...

       

-- 
Jason Christopher Child

Computer Network Service Professionals
VOZ Online



More information about the Tutor mailing list