Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
What are python modules? Name some commonly used built-in modules in Python?
Python modules are files containing Python code. This code can either be functions classes or variables. A Python module is a .py file containing executable code. Some of the commonly used built-in modules are: os sys math random data time JSON
Python modules are files containing Python code. This code can either be functions classes or variables. A Python module is a .py file containing executable code.
Some of the commonly used built-in modules are:
os
See lesssys
math
random
data time
JSON
What is namespace in Python?
A namespace is a naming system used to make sure that names are unique to avoid naming conflicts.
A namespace is a naming system used to make sure that names are unique to avoid naming conflicts.
See lessHow is memory managed in Python?
Memory is managed in Python in the following ways: 1. Memory management in python is managed by Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have access to this private heap. The python interpreter takes care of this insteadRead more
Memory is managed in Python in the following ways:
1. Memory management in python is managed by Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have access to this private heap. The python interpreter takes care of this instead.
See less2. The allocation of heap space for Python objects is done by Python’s memory manager. The core API gives access to some tools for the programmer to code.
3. Python also has an inbuilt garbage collector, which recycles all the unused memory and so that it can be made available to the heap space.
What are the new features added in Python 3.9.0.0 version?
The new features in Python 3.9.0.0 version are- 1.New Dictionary functions Merge(|) and Update(|=) 2. New String Methods to Remove Prefixes and Suffixes 3. Type Hinting Generics in Standard Collections 4. New Parser based on PEG rather than LL1 5. New modules like zoneinfo and graphlib 6. Improved MRead more
The new features in Python 3.9.0.0 version are-
1.New Dictionary functions Merge(|) and Update(|=)
See less2. New String Methods to Remove Prefixes and Suffixes
3. Type Hinting Generics in Standard Collections
4. New Parser based on PEG rather than LL1
5. New modules like zoneinfo and graphlib
6. Improved Modules like ast, asyncio, etc.
7. Optimizations such as optimized idiom for assignment, signal handling, optimized python built ins, etc.
8. Deprecated functions and commands such as deprecated parser and symbol modules, deprecated functions, etc.
9. Removal of erroneous methods, functions, etc.
What are Literals in Python and explain about different Literals?
A literal in python source code represents a fixed value for primitive data types. There are 5 types of literals in python- 1. String literals– A string literal is created by assigning some text enclosed in single or double quotes to a variable. To create multiline literals, assign the multiline texRead more
A literal in python source code represents a fixed value for primitive data types. There are 5 types of literals in python-
1. String literals– A string literal is created by assigning some text enclosed in single or double quotes to a variable. To create multiline literals, assign the multiline text enclosed in triple quotes. Eg.name=”Tanya”.
2. A character literal– It is created by assigning a single character enclosed in double quotes. Eg. a=’t’.
3. Numeric literals include numeric values that can be either integer, floating point value, or a complex number. Eg. a=50.
4. Boolean literals– These can be 2 values- either True or False.
5. Literal Collections– These are of 4 types-
a) List collections-Eg. a=[1,2,3,’Amit’]
b) Tuple literals- Eg. a=(5,6,7,8)
c) Dictionary literals- Eg. dict={1: ’apple’, 2: ’mango, 3: ’banana`’}
d) Set literals- Eg. {“Tanya”, “Rohit”, “Mohan”}
6. Special literal- Python has 1 special literal None which is used to return a null variable.
See lessWhat are Keywords in Python?
Keywords in python are reserved words that have special meaning.They are generally used to define type of variables. Keywords cannot be used for variable or function names. There are following 33 keywords in python- And Or Not If Elif Else For While Break As Def Lambda Pass Return True False Try WitRead more
Keywords in python are reserved words that have special meaning.They are generally used to define type of variables. Keywords cannot be used for variable or function names. There are following 33 keywords in python-
And
See lessOr
Not
If
Elif
Else
For
While
Break
As
Def
Lambda
Pass
Return
True
False
Try
With
Assert
Class
Continue
Del
Except
Finally
From
Global
Import
In
Is
None
Nonlocal
Raise
Yield
What is slicing in Python?
Slicing is used to access parts of sequences like lists, tuples, and strings. The syntax of slicing is-[start:end:step]. The step can be omitted as well. When we write [start:end] this returns all the elements of the sequence from the start (inclusive) till the end-1 element. If the start or end eleRead more
Slicing is used to access parts of sequences like lists, tuples, and strings. The syntax of slicing is-[start:end:step]. The step can be omitted as well. When we write [start:end] this returns all the elements of the sequence from the start (inclusive) till the end-1 element. If the start or end element is negative i, it means the ith element from the end. The step indicates the jump or how many elements have to be skipped. Eg. if there is a list- [1,2,3,4,5,6,7,8]. Then [-1:2:2] will return elements starting from the last element till the third element by printing every second element.i.e. [8,6,4].
See lessWhat is the difference between .py and .pyc files?
The .py files are the python source code files. While the .pyc files contain the bytecode of the python files. .pyc files are created when the code is imported from some other source. The interpreter converts the source .py files to .pyc files which helps by saving time.
The .py files are the python source code files. While the .pyc files contain the bytecode of the python files. .pyc files are created when the code is imported from some other source. The interpreter converts the source .py files to .pyc files which helps by saving time.
See less.What are the common built-in data types in Python?
The common built-in data types in python are- Numbers– They include integers, floating-point numbers, and complex numbers. eg. 1, 7.9,3+4i List– An ordered sequence of items is called a list. The elements of a list may belong to different data types. Eg. [5,’market’,2.4] Tuple– It is also an orderedRead more
The common built-in data types in python are-
Numbers– They include integers, floating-point numbers, and complex numbers. eg. 1, 7.9,3+4i
List– An ordered sequence of items is called a list. The elements of a list may belong to different data types. Eg. [5,’market’,2.4]
Tuple– It is also an ordered sequence of elements. Unlike lists , tuples are immutable, which means they can’t be changed. Eg. (3,’tool’,1)
String– A sequence of characters is called a string. They are declared within single or double-quotes. Eg. “Sana”, ‘She is going to the market’, etc.
Set– Sets are a collection of unique items that are not in order. Eg. {7,6,8}
Dictionary– A dictionary stores values in key and value pairs where each value can be accessed through its key. The order of items is not important. Eg. {1:’apple’,2:’mango}
Boolean– There are 2 boolean values- True and False.
See lessWhat are Dict and List comprehensions?
Dictionary and list comprehensions are just another concise way to define dictionaries and lists. Example of list comprehension is- 1 x=[i for i in range(5)] The above code creates a list as below- 1 2 4 [0,1,2,3,4] Example of dictionary comprehension is- 1 x=[i : i+2 for i in range(5)] The above coRead more
Dictionary and list comprehensions are just another concise way to define dictionaries and lists.
Example of list comprehension is-
1
x=[i for i in range(5)]
The above code creates a list as below-
1
2
4
[0,1,2,3,4]
Example of dictionary comprehension is-
1
x=[i : i+2 for i in range(5)]
The above code creates a list as below-
1
See less[0: 2, 1: 3, 2: 4, 3: 5, 4: 6]