Skip to content
Advertisement

Tag: list

Can I somehow pick a specific number from a list?

I’m new at programming and i need help with my “work”. I need to print specific number from a list. List = from 1 to 10 000 and i need to pick every single number that has “375” as a last three digits For example: 375, 1375, 2375 etc. My english isn’t the best so I hope you undestood me

New list based on indices from another list in Python

I have an array X and a list A1. I want to create a new list B1 such that it consists of values from X corresponding to indices in A1. For example, the code should pick values from X[0] for indices in A1[0] and so on…I present the current and expected outputs. The current output is The expected output is

Creating multiple sublists in Python

I have a list J with len(J)=2. I want to create a sublist of each element in J[i] where i=0,1. I present the current and expected output. The current output is The expected output is Answer you can try this, this will give you [[[1], [2], [4], [6], [7]], [[1], [4]]]

Merging two lists in a certain format in Python

I have two lists A and B. I am trying to merge the two lists into one in a specific format as shown in the expected output. I also show the current output. The current output is The expected output is Answer Or as @Mechanic Pig suggested in comments using list comprehension:

Advertisement