What objects can be put into a set?
Answer:
Objects like list, dict, set, and other mutable structures cannot be put in: they do not have a hash function (hash) and will cause a TypeError.
ta
Please open Telegram to view this post
VIEW IN TELEGRAM
โค1
Python tip:
Use the Path class from the pathlib module to work with file paths cross-platform.
๐ @DataScienceQ
Use the Path class from the pathlib module to work with file paths cross-platform.
from pathlib import Path
p = Path('/usr/local/bin')
Please open Telegram to view this post
VIEW IN TELEGRAM
โค3
๐ NumPy Python Tips
๐ข Boost your Python skills with NumPy! Learn quick tips for efficient array creation and manipulation to level up your data handling.
โก Tap to unlock the complete answer and gain instant insight.
โโโโโโโโโโโโโโโ
By: @DataScienceQ โจ
๐ข Boost your Python skills with NumPy! Learn quick tips for efficient array creation and manipulation to level up your data handling.
โก Tap to unlock the complete answer and gain instant insight.
โโโโโโโโโโโโโโโ
By: @DataScienceQ โจ
Telegraph
NumPy Python Tips
Python tip:Create an uninitialized array (contents are arbitrary) for performance.import numpy as npempty_array = np.empty((2, 3))
โค1
Tired of missing perfect GOLD entries?
Last week alone: 1,740 pips profit, 10/12 trades wonโall shared live in our channel.
Ready to catch the next move? Stay ahead with premium signals & real-time updatesโdonโt just watch, start profiting!
Join GOLD PIPS SIGNALS before the next trade drops!
#ad InsideAds
Last week alone: 1,740 pips profit, 10/12 trades wonโall shared live in our channel.
Ready to catch the next move? Stay ahead with premium signals & real-time updatesโdonโt just watch, start profiting!
Join GOLD PIPS SIGNALS before the next trade drops!
#ad InsideAds
โค1
๐ Remote Work โ India Only ๐ฎ๐ณ
๐ฐ Earn $800โ$2000/month
๐ Weekly payments โ card or crypto
๐ Work 3โ4 hours/day
๐ Fully remote โ no office, no experience needed
๐ Training provided
๐ Indian citizens aged 25+ only
๐ฉ Message our HR manager to apply today!
#ad InsideAds
๐ฐ Earn $800โ$2000/month
๐ Weekly payments โ card or crypto
๐ Work 3โ4 hours/day
๐ Fully remote โ no office, no experience needed
๐ Training provided
๐ Indian citizens aged 25+ only
๐ฉ Message our HR manager to apply today!
#ad InsideAds
โค2
What can be a key in a dictionary?
Answer:
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
โค3
๐ Master Vue.js for Modern UIs
๐ข Master Vue.js, the intuitive JavaScript framework, and confidently build modern, reactive user interfaces. Your journey to dynamic web apps starts here!
โก Tap to unlock the complete answer and gain instant insight.
โโโโโโโโโโโโโโโ
By: @DataScienceQ โจ
๐ข Master Vue.js, the intuitive JavaScript framework, and confidently build modern, reactive user interfaces. Your journey to dynamic web apps starts here!
โก Tap to unlock the complete answer and gain instant insight.
โโโโโโโโโโโโโโโ
By: @DataScienceQ โจ
Telegraph
Master Vue.js for Modern UIs
๐ Learn Vue.js โ JavaScript Framework Course
๐ Python MCP Server: Create & Learn
๐ข Unlock Minecraft's secrets! Build your own custom Minecraft Protocol (MCP) server with Python for ultimate game customization and deep dives into mechanics.
โก Tap to unlock the complete answer and gain instant insight.
โโโโโโโโโโโโโโโ
By: @DataScienceQ โจ
๐ข Unlock Minecraft's secrets! Build your own custom Minecraft Protocol (MCP) server with Python for ultimate game customization and deep dives into mechanics.
โก Tap to unlock the complete answer and gain instant insight.
โโโโโโโโโโโโโโโ
By: @DataScienceQ โจ
Telegraph
Python MCP Server: Create & Learn
๐ Building Your Own Minecraft Protocol (MCP) Server with Python
โค1
When an attribute is defined both in the instance and in the class, Python always takes the value from the instance.
The class attribute is used only if it is not present in the instance.
๐ @DataScienceQ
The class attribute is used only if it is not present in the instance.
class Warehouse:
purpose = "storage"
region = "west"
w1 = Warehouse()
print(w1.purpose, w1.region) # storage west
w2 = Warehouse()
w2.region = "east"
print(w2.purpose, w2.region) # storage east
Please open Telegram to view this post
VIEW IN TELEGRAM
What is a deep copy?
Answer:
In Python, this is done using copy.deepcopy(), which creates a fully independent data structure, including nested lists, dictionaries, and other objects.
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
๐4โค1
Tip for clean tests in Python:
Structure your tests with the Arrange-Act-Assert pattern to improve readability and maintainability.
โข Arrange: Set up the test. Initialize objects, prepare data, and configure any mocks or stubs.
โข Act: Execute the code being tested. Call the specific function or method.
โข Assert: Check the outcome. Verify that the result of the action is what you expected.
#Python #Testing #CleanCode #SoftwareEngineering #Pytest #DeveloperTips #AAA
โโโโโโโโโโโโโโโ
By: @DataScienceQ โจ
Structure your tests with the Arrange-Act-Assert pattern to improve readability and maintainability.
โข Arrange: Set up the test. Initialize objects, prepare data, and configure any mocks or stubs.
โข Act: Execute the code being tested. Call the specific function or method.
โข Assert: Check the outcome. Verify that the result of the action is what you expected.
import pytest
from dataclasses import dataclass, field
# Code to be tested
@dataclass
class Product:
name: str
price: float
@dataclass
class ShoppingCart:
items: list[Product] = field(default_factory=list)
def add_item(self, product: Product):
if product.price < 0:
raise ValueError("Product price cannot be negative.")
self.items.append(product)
def get_total_price(self) -> float:
return sum(item.price for item in self.items)
# Tests using the Arrange-Act-Assert pattern
def test_get_total_price_for_multiple_items():
# Arrange
product1 = Product(name="Mouse", price=25.50)
product2 = Product(name="Keyboard", price=75.50)
cart = ShoppingCart()
cart.add_item(product1)
cart.add_item(product2)
# Act
total_price = cart.get_total_price()
# Assert
assert total_price == 101.00
def test_get_total_price_for_empty_cart():
# Arrange
cart = ShoppingCart()
# Act
total_price = cart.get_total_price()
# Assert
assert total_price == 0.0
def test_add_item_with_negative_price_raises_value_error():
# Arrange
cart = ShoppingCart()
product_with_negative_price = Product(name="Invalid Item", price=-50.0)
# Act & Assert
with pytest.raises(ValueError, match="Product price cannot be negative."):
cart.add_item(product_with_negative_price)
#Python #Testing #CleanCode #SoftwareEngineering #Pytest #DeveloperTips #AAA
โโโโโโโโโโโโโโโ
By: @DataScienceQ โจ
Why does
list.sort() return None instead of the sorted list?Answer:
If a new sorted list is needed, the built-in sorted() function is used, which returns the result without changing the original.
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
Are there generics in Python like in Java or C++?
Answer:
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
300 Real Time SQL Interview.pdf
4.5 MB
300 Real Time SQL Interview practical Questions Asked at multiple companies
โขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโข
Anyone who's preparing for an interview just reading theoretical concept will not help definitely you need to have practical hands on in #sql so create table with some data and try this queries running by your self so can help you to understand the logic of similar kind of queries
If you're preparing for an interview this doc will help a lot in the perpetration If you're experienced also freshers can also get hands on by practicing these queries and get confidence.
โขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโขโข
Anyone who's preparing for an interview just reading theoretical concept will not help definitely you need to have practical hands on in #sql so create table with some data and try this queries running by your self so can help you to understand the logic of similar kind of queries
If you're preparing for an interview this doc will help a lot in the perpetration If you're experienced also freshers can also get hands on by practicing these queries and get confidence.
https://t.iss.one/DataScienceQ
โค3
Forwarded from Python | Machine Learning | Coding | R
๐ THE 7-DAY PROFIT CHALLENGE! ๐
Can you turn $100 into $5,000 in just 7 days?
Lisa can. And sheโs challenging YOU to do the same. ๐
https://t.iss.one/+AOPQVJRWlJc5ZGRi
https://t.iss.one/+AOPQVJRWlJc5ZGRi
https://t.iss.one/+AOPQVJRWlJc5ZGRi
Can you turn $100 into $5,000 in just 7 days?
Lisa can. And sheโs challenging YOU to do the same. ๐
https://t.iss.one/+AOPQVJRWlJc5ZGRi
https://t.iss.one/+AOPQVJRWlJc5ZGRi
https://t.iss.one/+AOPQVJRWlJc5ZGRi
โค2
What do you know about NoSQL databases?
Answer:
These databases scale well horizontally: data is distributed across cluster nodes, which helps handle high loads and large volumes. Different storage models are supported โ key-value, document, columnar, and graph. This allows choosing the appropriate structure for a specific task.
Common systems include MongoDB (documents), Cassandra (columns), Redis (key-value), and Neo4j (graphs). They are used where scalability, speed, and data flexibility are important.
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
PyData Careers
Python Data Science jobs, interview tips, and career insights for aspiring professionals.
What does it mean that a QuerySet in Django is "lazy"?
Answer:
The actual database access happens only when the results are really needed: when iterating over the QuerySet, calling list(), count(), first(), exists(), and other methods that require data.
This approach helps avoid unnecessary database hits and improves performance โ queries are executed only at the moment of real necessity.
tags: #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
PyData Careers
Python Data Science jobs, interview tips, and career insights for aspiring professionals.
๐1
Forwarded from Python | Machine Learning | Coding | R
๐ THE 7-DAY PROFIT CHALLENGE! ๐
Can you turn $100 into $5,000 in just 7 days?
Lisa can. And sheโs challenging YOU to do the same. ๐
https://t.iss.one/+AOPQVJRWlJc5ZGRi
https://t.iss.one/+AOPQVJRWlJc5ZGRi
https://t.iss.one/+AOPQVJRWlJc5ZGRi
Can you turn $100 into $5,000 in just 7 days?
Lisa can. And sheโs challenging YOU to do the same. ๐
https://t.iss.one/+AOPQVJRWlJc5ZGRi
https://t.iss.one/+AOPQVJRWlJc5ZGRi
https://t.iss.one/+AOPQVJRWlJc5ZGRi