del keyword in Python | Example code
Python del keyword is used to delete objects. It could delete everything from an object like variables, lists, dictionaries, slice a list, etc. Examples del… Read More »del keyword in Python | Example code
python
Python del keyword is used to delete objects. It could delete everything from an object like variables, lists, dictionaries, slice a list, etc. Examples del… Read More »del keyword in Python | Example code
Use pop() method or del keyword to remove an element from list python by index. The pop() is useful to remove and keep an item… Read More »Remove element from list Python by index | Example code
Use the remove() method to remove an element from a list by value in Python. But it does not remove all occurrences of a given… Read More »Python remove element from list by value | Example code
Use the del keyword or pop() function to pop the first element from a list in Python. These both will modify the given original list.… Read More »Python list pop first element | Example code
You can create your own isEmpty function to check check if a list is empty in Python. Use not operator with if statement. Example code… Read More »Python list isEmpty | Example code
Char can iterate using a for loop in Python. Let’s see how to iterate over characters of a string in Python. Just iterate through the… Read More »Python for char in string | Example code
If the while loop body consists of one statement, write this statement into the same line: while True: print(‘Hello’). Even you can write a single… Read More »Single line while loop Python | Example code
Python merges two lists without duplicates could be accomplished by using a set. And use the + operator to merge it. Python merge list without… Read More »Python merge two lists without duplicates | Example code
There is no tuple comprehension in Python. Comprehension works by looping or iterating over items and assigning them into a container, a Tuple is unable… Read More »Tuple comprehension Python | Example code
Use PEP 8 recommended method to check if the list is empty in Python. In the method doing “Truth Value Testing” where check if the… Read More »Python if list is empty | Example code