Featured Post

14 Top Data Pipeline Key Terms Explained

Image
 Here are some key terms commonly used in data pipelines 1. Data Sources Definition: Points where data originates (e.g., databases, APIs, files, IoT devices). Examples: Relational databases (PostgreSQL, MySQL), APIs, cloud storage (S3), streaming data (Kafka), and on-premise systems. 2. Data Ingestion Definition: The process of importing or collecting raw data from various sources into a system for processing or storage. Methods: Batch ingestion, real-time/streaming ingestion. 3. Data Transformation Definition: Modifying, cleaning, or enriching data to make it usable for analysis or storage. Examples: Data cleaning (removing duplicates, fixing missing values). Data enrichment (joining with other data sources). ETL (Extract, Transform, Load). ELT (Extract, Load, Transform). 4. Data Storage Definition: Locations where data is stored after ingestion and transformation. Types: Data Lakes: Store raw, unstructured, or semi-structured data (e.g., S3, Azure Data Lake). Data Warehous...

How to Explain String Immutability in Python Correctly

Here is an answer to explain the immutability of Strings in Python. It means that you can't modify the string. Due to this, you can use strings securely in many places of your project.


Strings Immutability


How to check string immutability

Here is an example. In the python shell, assign a value of your choice to a string. Here my choice is ABCD, and I have assigned it to myString. I have tried to replace A with Z. But, it gave an error due to the immutability of strings.


>>> myString = 'ABCD'
>>>myString [0] = 'Z'


What is learning here

The strings immutability is an interview question. In interviews, you can say that strings are immutable, and you can't replace its data.

Benefits of strings immutability

  1. It saves a lot of time since the data in strings are immutable. It results in high performance.
  2. String objects you can reuse as no one can modify its value.
  3. Strings are elemental. So no activity can change its value ( these are more like numbers).

References

Comments

Popular posts from this blog

How to Fix datetime Import Error in Python Quickly

SQL Query: 3 Methods for Calculating Cumulative SUM

Big Data: Top Cloud Computing Interview Questions (1 of 4)