Python : Return List Containing All The Mismatched Words
Автор: Grow with Data
Загружено: 2023-12-24
Просмотров: 260
Описание:
Video 35: This video unveils an exploration into comparing two strings and retrieving the words absent in the other string. We start with a few fundamental assumptions:
1. Each word in the strings is unique, ensuring no word repetition within a single string.
2. The input strings might be empty.
3. The comparison is case-sensitive.
Our investigation unfolds in three distinct methods:
1. General FOR loop: Initiating with a split of string-1, we traverse each word in string-2, scrutinizing their presence in string-1. If found, we eliminate the word from string-1. Otherwise, the word joins a separate list. Ultimately, we amalgamate both lists from string-1 and string-2, presenting a unified list.
2. Duplicate Handling: Employing the SET() function, we obliterate duplicates, following the same course as Approach-1 for unmatched word identification.
3. SET() Operations: Here, string splitting leads to SET() instantiation. By leveraging the SET operator MINUS, we extract unique words from each string. A UNION of both sets delivers the final result.
The Python functions central to this exploration include split(), set(), list concatenation (list1 + list2), list.remove(), and element deletion (del list[x]). This informative exercise broadens our understanding of string manipulation and set operations in Python.
code: https://github.com/jeganpillai/python...
Follow me on,
Website : https://growwithdata.co/
YouTube : / @growwithdata
TikTok : / growwithdata
LinkedIn : / growwithdata
Facebook : / growwithdata.co
twitter : / growwithdata_co
WhatsApp : https://whatsapp.com/channel/0029VaF8...
Instagram : / growwithdata.co
#recursive #countingalgorithm #list #looping #listmanipulation #uniquesubstring #longestsubstring #slicing #lineartimecomplexity #python #pythonquestions #pythontest #pythonprogramming #pythontutorial #python3 #pythonforbeginners #interviewquestions #interview #dataengineers #deinterview #pythoninterview #interviewquestions #leetcode #placementpreparation #meta #google #facebook #apple #netflix #amazon #google #faang #maanga #dataengineers #alphanumeric #nonalphanumeric #growwithdata #set #split #remove #pythonfunctions
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: