Q141. What does len() do?
The built-in **`len()`** function returns the number of items (cardinality) in an object: ```python len("Python") # 6 (number of characters) len([1, 2, 3, 4, 5]) # 5 (num...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (338 available).
The built-in **`len()`** function returns the number of items (cardinality) in an object: ```python len("Python") # 6 (number of characters) len([1, 2, 3, 4, 5]) # 5 (num...
To modify the strings, Python's "re" module is providing 3 methods. They are: split() – uses a regex pattern to "split" a given string into a list. sub() – finds all subs...
The sequences in Python are indexed and it consists of the positive as well as negative numbers. The numbers that are positive uses '0' that is uses as first index and '1...
A **Python package** is a folder containing modules and typically an `__init__.py` file. Packages organize modules into a hierarchical dot-separated namespace (e.g., `url...
To delete a file in Python, you need to import the OS Module. After that, you need to use the os.remove() function. Example: 1 2 ```python import os ``` os.remove("xyz.tx...
Python provides a comprehensive set of built-in data types organized into distinct structural families: ### 1. Numeric Types: - `int`: Unlimited-precision integers. - `fl...
Python's lists are efficient general-purpose containers. They support (fairly) efficient insertion, deletion, appending, and concatenation, and Python's list comprehensio...
Elements can be added to an array using the append(), extend() and the insert (i,x) functions. Example: a=arr.array('d', [1.1 , 2.1 ,3.1] ) a.append(3.4) print(a) a.exten...
Array elements can be removed using pop() or remove() method. The difference between these two functions is that the former return s the deleted value whereas the latter ...
Python is an object-oriented programming language. This means that any program can be solved in python by creating an object model. However, Python can be treated as proc...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.