Im trying to access a variable in a list that is 3 places earlier in the list. For example list_1[dogs, cats, pigs, hamsters, kids]. If Im trying to access the word cats based on the position of kids how would I do that? I know list_1[4] returns kids and I want to be able to return cats without using list_1[1]. I tried making list_1[4] = a and then doing print list_1[a - 3] but i get a syntax error since I cant subtract an int from a string. Anyone think they can help me out? Thanks
dmcadidas15 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.