Python Resources - Basic Python, ML, DataScience, BigData
2.41K subscribers
14 photos
3 files
243 links
You can find all kinds of resources related to Python, ML, DataScience and BigData.
Resources — »»» @python_resources_iGnani
Projects — »»» @python_projects_repository
Questions— »»» @python_interview_questions
Forum — »»» @python_programmers_club
Download Telegram
Forwarded from Python Questions
*

myList = [1, 2, 3, 4, 2, 2, 3, 1, 4, 4, 4,5,5,6,7,6,5]

A) Write a program to get the value that appears more number of times
B) When there is a tie, then get the number which is the smallest of them

#python #practiceCode #samples #interviewQuestions #numbers #list
Forwarded from Python Questions
*

name = 'ppy!'
Write code to insert the letter 'a' in-between each letter to form the word 'papaya!'

#python #practiceCode #samples #interviewQuestions #strings #list
Forwarded from Python Questions
#interviewQuestions : 0008
List.copy() does a shallow copy of the list, but when we check their id's they point to different address? Why?

A shallow copy means constructing a new collection object and then populating it with references to the child objects found in the original.

Hence, when you check their id's they both point to different address.

check out this code
L1 = 1, 2, 3, 4

# Using copy() to create a shallow copy
L2 = L1.copy()

print(id(L1), id(L2))
>>> 2763664559240 2763665433480
In the above result, address are different, they both point to different locations.


But, the elements will be pointing to the same objects in both the
lists.
Check this code:

print(id(L10), id(L20))
>>> 140703554137856 140703554137856

See the result, the elements point to the same address in memory.

#list #collection #shallowCopy