What does mean

0 votes
I have been working on a Python code. Can someone explain me the meaning of [:] in the following:

pop = population[:]
 

Is it something like array lists in Java or like a bi-dimensional array?
Jan 16, 2019 in Python by ana1504.k
• 7,910 points
2,603 views

1 answer to this question.

0 votes
It's a slicing, and what it does depends on the type of population. If population is a list, this line will create a copy of the list. For an object of type tuple or a str, it will do nothing (the line will do the same without [:]), and for a NumPy array, it will create a new view to the same data.
answered Jan 16, 2019 by SDeb
• 13,300 points

Related Questions In Python

+4 votes
3 answers

What does these operator mean **, ^, %, // ?

** - Performs exponential (power) calculation on ...READ MORE

answered Apr 12, 2018 in Python by anto.trigg4
• 3,440 points
1,385 views
0 votes
1 answer

What does ' -> ' mean in Python function definitions?

It's a function annotation. In more detail, Python 2.x ...READ MORE

answered May 23, 2018 in Python by charlie_brown
• 7,720 points
905 views
0 votes
1 answer

What does AF_INET mean?

AF_INET refers to Address from the Internet ...READ MORE

answered Jul 3, 2019 in Python by Wajiha
• 1,960 points
4,736 views
0 votes
0 answers

What does NameError: name 'withdrawal' is not defined mean ?

READ MORE

Jun 6, 2020 in Python by Shanice
• 120 points

recategorized Jun 8, 2020 by Gitika 887 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,422 views
0 votes
1 answer
0 votes
1 answer

What does enumerate mean?

The enumerate() function adds a counter to ...READ MORE

answered Oct 11, 2018 in Python by SDeb
• 13,300 points
625 views
0 votes
1 answer

What does the return statement do in Python?

The print() function is use to write ...READ MORE

answered Oct 1, 2018 in Python by SDeb
• 13,300 points
1,363 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP