Python Basic Questions
SHOAIB SHAIK
?? Published author, AI and Deep learning; fascinated with technology with a deep passion to use technology to make the world a better place. Time, space, Quantum computing are traits I am happy to be involved.
\
Parser: What is the position of the parser
we use the parser to have the code translated to the byte code level
- Hardware is highly protective
os is the complete author of the hardware
os has a component called kernel(linux) HAL for windows
- datatype in the python is Number Sequence type listtuplesetdicstringBoolean nonecomplex type
- Display the list of packages in python
Python list
- display the path in the python
python --list-paths
- What is os package
import OS
- what is the sys package
import sys
os.path.dirname(sys.executable)
- What is module
we are using the program in the same application called the module
- What is package
A collection of modules that are developed in an application, Which are used in a different application is called a package.
- What is Stdin
“standard input device fileâ€
- EOL : End of the LIne
- How would you represent your code in long line
we use “““ ““““ to store. It is also called Documentation string and documentation and the string is called documentation string
- to clear the screen in python, we can use the Command
os.system(“clsâ€)
- Why we need to use Print()\
Anything to the output will be the object
- Does print return any thing
The print does not return anything, IT just print
- What are the parameters in print()
we have *Objects, sep, file, flush
- How to tell Python the version
we can use #!Python3
Import os
os.system(“clsâ€)
- What is the type conversion
we are using type conversation to covert the objects or we can say converting one data type to another datatype
- What is auto-type inferencing intelligence
on fly, the datatype is decided by the python
Auxiliary memory
we are using this for the permanent storage
Statical typing
we can type the value in a static type
- What is the datatype in Python
According to the python a datatype is actually a declared class in the python namespace
every datatype in python prescribes the
properties of the instance
behaviors of its instance
- What are type classes
(to recognize the data type )Type classes come into the picture When python wants to catch the data type
- what is the use of type class in Pythonthe type class is an operation in Python that assigns the datatype at runtime in the execution
- What is a Python garbage collector? In Python garbage collector will automatically remove the old value in the memory
- what are cascade declaration and initializationauto allocate the same value to one namespace (address in the application)
- How will you see the datatype for a class w e can use type(“object“) we can see the type of the class
- What is bit artictureit is a form how much data is transfer in a sec 32 bit 64bit 128bit
- what are the data input standards in pythonWe have the basic standared like keyboardit can interact with python CLI(Command line interface)when we are accepting the data it need to be assigned to a variable declared in python All the data that is accepted in python will be a string by default Any number will also be auto-converted in the “stringâ€
What is ecoing in input()
we are taking the input value at the run time and then we are printing the same value in the CLI it is called ecoing
How can you get the hexa decimal value in the python
- we can use Hex() it will give the hex value
- why you cannot use the input value in adding any two integer as there the int value will be converted to the int value.
- What is type casting
to convert one data type to another datatype
- Python we have type conversion, how many types are there
We have two type of type conversion we are below
immediate-type casting
later type casting
it is type converstion the developer will convert the input value at the scaned time
领英推è
the developer will capture will capture the valeue as a string and when scanned input value in any expression the developer will convert the scanned data object to the required data type
- what is the data type which is in input()we are going to have every input value as string
- How will you convert the datatype in python we should be calling the corresponding type class constructor method
- What is the code you will see when type casting immediately
Typeconstructor(input())
- how the code will look when it is in the later type converstionvariable = input()result = typeconstructor(variable)
- When data type are changing for the same value are the memory location same or changing they will have different memory locations.
- why do we use compound statementswe use compound statements for optimization.speed of assigment is good and speed of optimization of greatexample for a compound statement is value +=30
- What are bit-wise operator and or
how will converter the decimal number in binary vale
we can use the bin() function to show the binary value
how will you use the standardized bit fill operators to fill the remaining bits
we can use the zfill() function.
what is Compound assigment
we are assigning the function and doing the calculation at the same time.
If statement
simpleif
- what is a block in Python called
it is called a suit
- What is an indentation in Python
it calculates the block only with the indentation.
- What are the control structure in Python
sequence control structure
selection principal control structure
iterative control structure
- Sequence control structure
programs that are intelligent in the operational implementation, but not in situations or circumstances
- selection principal control structureselection principal control structure is used when there is any ideal condition.
- what are selection principal control structures also called?
selection principal control structure also called decision control structure.
- what are the three keywords for the selection control structure?
IF
Else
Elseif
- indentation applied in the control structure is single, multiple space, or tab space.
- all the blocks in the program are called Python suit
#brancin python
- branching is used by using the if statement.
- what is the control statement in python
""" We have Sequential control selective /(decision ) iterative control """
""" the branching principles in Python is implemented using the if keyword if always execute a condition to make the program execute applying selective control statement the values that can return the bollen function can only be used in the if statement we have IF and else if and else if """
- do we require to use the brackets for the condition
we do not require but it is profrellisum
- What is the colen in the python
Colen is used to state that the next are statements.
- when we are using any type casting in the program and hit enter what are we going to get
we get value error as the input data is null()
- what if have not used any type of casting and we give an enter to a value?
the value will be accepted as a string and entered.
- With in the if branch, what is every value considered as true?
Yes within the if branch any value is considered as true except 0 as it is the only thing that is considered false.
- when if is handling a single state of operation or expression eith in the true state or false state we can keep the operation statement immediately after the colon, either in if or else.
``