Saraswat World
What is Slicing in Python?
We can use Slicing in Python to get a substring from a String. The syntax of Slicing is very convenient to use. E.g. In following example we are getting a substring out of the name John. >>> name=”John” >>> name[1:3] ‘oh’ In Slicing we can give two indices in the String to create a Substring.…
What is the use of Pass statement in Python?
The use of Pass statement is to do nothing. It is just a placeholder for a statement that is required for syntax purpose. It does not execute any code or command. Some of the use cases for pass statement are as follows: I. Syntax purpose: >>> while True: … pass # Wait till user input…
How to concatenate multiple strings together in Python?
We can use following ways to concatenate multiple string together in Python: I. use + operator: E.g. >>> fname=”John” >>> lname=”Ray” >>> print fname+lname JohnRay II. use join function: E.g. >>> ”.join([‘John’,’Ray’]) ‘JohnRay’
What is a Namespace in Python?
A Namespace in Python is a mapping between a name and an object. It is currently implemented as Python dictionary. E.g. the set of built-in exception names, the set of built-in names, local names in a function. At different moments in Python, different Namespaces are created. Each Namespace in Python can have a different lifetime.…
What are the different builtin datatypes available in Python?
Some of the built-in data types available in Python are as follows: Numeric types: These are the data types used to represent numbers in Python. int: It is used for Integers long: It is used for very large integers of non-limited length. float: It is used for decimal numbers. complex: This one is for representing…
What is the difference between List and Dictionary data types in Python?
Main differences between List and Dictionary data types in Python are as follows: I. Syntax: In a List we store objects in a sequence. In a Dictionary we store objects in key-value pairs. II. Reference: In List we access objects by index number. It starts from 0 index. In a Dictionary we access objects by…
How are arguments passed in a Python method?
Every argument in a Python method is an Object. All the variables in Python have reference to an Object. Therefore arguments in Python method are passed by Reference. Since some of the objects passed as reference are mutable, we can change those objects in a method. But for an Immutable object like String, any change…
What is a Python Decorator?
A Python Decorator is a mechanism to wrap a Python function and modify its behavior by adding more functionality to it. We can use @ symbol to call a Python Decorator function.
What is the difference between a Tuple and List in Python?
In Python, Tuple and List are built-in data structures. Some of the differences between Tuple and List are as follows: I. Syntax: A Tuple is enclosed in parentheses: E.g. myTuple = (10, 20, “apple”); A List is enclosed in brackets: E.g. myList = [10, 20, 30]; II. Mutable: Tuple is an immutable data structure. Whereas,…
How will you perform Static Analysis on a Python Script?
We can use Static Analysis tool called PyChecker for this purpose.PyChecker can detect errors in Python code.PyChecker also gives warnings for any style issues.Some other tools to find bugs in Python code are pylint and pyflakes.
How does memory management work in Python?
There is a private heap space in Python that contains all the Python objects and data structures. In CPython there is a memory manager responsible for managing the heap space. There are different components in Python memory manager that handle segmentation, sharing, caching, memory pre-allocation etc. Python memory manager also takes care of garbage collection…
What is Pickling in Python?
Pickling is a process by which a Python object hierarchy can be converted into a byte stream. The reverse operation of Pickling is Unpickling. Python has a module named pickle. This module has the implementation of a powerful algorithm for serialization and de-serialization of Python object structure. Some people also call Pickling as Serialization or…
PYTHON INTERVIEW QUESTIONS
PYTHON INTERVIEW QUESTIONS
-
CHAT GPT VS GOOGLE BARD
Google Bard is an answer to Microsoft-backed AI-based Chat GPT. Alphabet and Google CEO Sundar Pichai recently announced the project describing it as an “experimental conversational AI service” that will answer users’ queries and take part in conversations. The software will be available to a group of “trusted testers” today, says Pichai, before becoming “more…
-
SQL FREE COURSE
Learn SQL
-
TRAVEL
Travel and Tourism
-
BUSINESS ANALYST
Explore The World of Business Analyst.
-
What is a Derivative?
DERIVATIVES
-
ONGC Government Job Vacancies
ONGC Recruitment by GATE 2021 Engineering & Geo-Science Trainee Recruitment Oil and Natural Gas Corporation Ltd. (ONGC) is running a major recruitment drive of recruiting Graduate Engineer Trainees in E1 grade in various Engineering and Geo-Science disciplines. Candidates interested in joining as Graduate Engineer Trainees through GATE-2021 test score should apply Online in the prescribed…
-
FSSAI Government Job Vacancy Recruitment
The Food Safety and Standards Authority of India (FSSAI) invites online applications in the prescribed format for following various Government Job Vacancies of Officers, Director, Managers, Engineers, Assistants etc. in Group-A, Group-B and Group-C on direct recruitment basis from candidates looking for opportunities in the Food Regulatory System . (Advertisement No. DR-02-03-04/2021) FSSAI Vacancies 2021…