Python Data Science Jobs & Interviews
19.6K subscribers
195 photos
4 videos
24 files
301 links
Your go-to hub for Python and Data Science—featuring questions, answers, quizzes, and interview tips to sharpen your skills and boost your career in the data-driven world.

Admin: @Hussein_Sheikho
Download Telegram
Question 22 (Interview-Level):
Explain the difference between deepcopy and regular assignment (=) in Python with a practical example. Then modify the example to show how deepcopy solves the problem.

import copy

# Original Problem
original = [[1, 2], [3, 4]]
shallow_copy = original.copy()
shallow_copy[0][0] = 99
print(original) # What happens here?

# Solution with deepcopy
deep_copied = copy.deepcopy(original)
deep_copied[1][0] = 77
print(original) # What happens now?


Options:
A) Both modify the original list
B) copy() creates fully independent copies
C) Shallow copy affects nested objects, deepcopy doesn't
D) deepcopy is slower but creates true copies

#Python #Interview #DeepCopy #MemoryManagement

By: https://t.iss.one/DataScienceQ
2
🔥 Trending Repository: tech-interview-handbook

📝 Description: 💯 Curated coding interview preparation materials for busy software engineers

🔗 Repository URL: https://github.com/yangshun/tech-interview-handbook

🌐 Website: https://www.techinterviewhandbook.org

📖 Readme: https://github.com/yangshun/tech-interview-handbook#readme

📊 Statistics:
🌟 Stars: 130K stars
👀 Watchers: 2.2k
🍴 Forks: 15.8K forks

💻 Programming Languages: TypeScript - JavaScript - Python

🏷️ Related Topics:
#algorithm #algorithms #interview_practice #interview_questions #coding_interviews #interview_preparation #system_design #algorithm_interview #behavioral_interviews #algorithm_interview_questions


==================================
🧠 By: https://t.iss.one/DataScienceM
1
Interview Question

What types of file objects are there?

Answer: In Python, file objects are abstractions that provide a unified interface for working with different data sources. They are divided into three types:

▶️Text (TextIO) — work with strings (str) and automatically encode/decode data. For example: open("file.txt", "r", encoding="utf-8").

▶️Binary (BufferedIO) — operate with bytes and are often used for images, videos, or arbitrary data. For example: open("image.jpg", "rb").

▶️Low-level (raw) (RawIO) — provide direct access to devices or files without buffering. Usually used inside the standard library, rarely applied directly.

All these types implement interfaces from io — io.TextIOBase, io.BufferedIOBase, and io.RawIOBase. The standard open() function under the hood returns the appropriate object depending on the mode.


tags: #interview

https://t.iss.one/DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
Interview question

What is a hash table and where is it used in Python?

Answer: A hash table is a data structure that stores key–value pairs and provides fast access by key in time close to O(1).

In Python, the built-in dict and set structures are implemented based on hash tables:

▶️ Keys are hashed using __hash__() and compared via __eq__();

▶️ The hash code is used to compute the index in the array where the element is placed;

▶️ Starting from Python 3.6 (and guaranteed from 3.7), dict preserves the insertion order of keys thanks to the compact dict.

Important: the key must be hashable — that is, have an immutable hash and a consistent implementation of __hash__() and __eq__().


tags: #interview

https://t.iss.one/DataScienceQ
Please open Telegram to view this post
VIEW IN TELEGRAM
Interview question

Why is None a singleton object in Python?

Answer: None is the sole instance (singleton) of the NoneType, and all variables containing None refer to the same object. This saves memory because new instances are not created.

tags: #interview

https://t.iss.one/DataScienceQ

💪 Become a member: Mine. Invite. Earn. Start now | InsideAds
Please open Telegram to view this post
VIEW IN TELEGRAM