Hay, I am a noob, to the programing world, so i need a little help with lists. My problem is; I would like to create a list that contains the percent that each number of the first list is of sum of the firs list list.
so like this.

first_list=[1,2,3,4,5]
second_list=[6.6,13.3,20.0,26.6,33.3]

Recommended Answers

All 4 Replies

I'll give you a few pointers to get started, but you'll learn a lot more if you actually write the code yourself. I'd started by summing up the total of the first list and storing it in a variable.

Then you would probably want to loop through the first list again, and for each number do some very basic math and then store that into the second list.

Try this and see how far you get. Are you having problems with the math? or the code?

-Michael

Thanks for the tip, I think my problem was in the math part, i forgot to convert to a float before dividing.

Ah, yep that is a pretty common problem. If you have any other questions just ask.

-Michael

Thanks, Will do

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.