Home/python/Page 2
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.
Is indentation necessary in Python?
Indentation is required in Python if not done properly the code is not executed properly and might throw errors. Indentation is usually done using four space characters.
Indentation is required in Python if not done properly the code is not executed properly and might throw errors. Indentation is usually done using four space characters.
See lessDefine a function in Python.
A block of code that is executed when it is called is defined as a function. The keyword def is used to define a Python function.
A block of code that is executed when it is called is defined as a function. The keyword def is used to define a Python function.
See lessWhat are the limitations of Python?
There are limitations to Python, which include the following: It has design restrictions. It is slower when compared with C and C++ or Java. It is inefficient for mobile computing. It consists of an underdeveloped database access layer.
There are limitations to Python, which include the following:
Do runtime errors exist in Python? Give an example
Yes, runtime errors exist in Python. For example, if you are duck typing and things look like a duck, then it is considered a duck even if that is just a flag or stamp. The code, in this case, would be a run-time error. For example, Print “askthescience.com” would result in the runtime error of theRead more
Yes, runtime errors exist in Python. For example, if you are duck typing and things look like a duck, then it is considered a duck even if that is just a flag or stamp. The code, in this case, would be a run-time error. For example, Print “askthescience.com” would result in the runtime error of the missing parenthesis that is required by print ( ).
See lessCan we reverse a list in Python?
Yes, we can reserve a list in Python using the reverse() method. The code is as follows: defreverse(s): str = "" for i in s: str = i + str return str
Yes, we can reserve a list in Python using the reverse() method. The code is as follows:
See lessdefreverse(s):
str = ""
for i in s:
str = i + str
return str
Can we use a break and continue together in Python? How?
Break and continue can be used together in Python. The break will stop the current loop from execution, while the jump will take it to another loop.
Break and continue can be used together in Python. The break will stop the current loop from execution, while the jump will take it to another loop.
See lessIn how many ways can we apply reverse strings?
There are five ways in which the reverse string can be applied: Loops Recursions Stacks Extended slice syntax Reversed function
There are five ways in which the reverse string can be applied:
Define slicing in Python.
Slicing refers to the mechanism to select the range of items from sequence types like lists, tuples, strings.
Slicing refers to the mechanism to select the range of items from sequence types like lists, tuples, strings.
See lessHow is a file deleted in Python?
The file can be deleted by either of these commands: os.remove(filename) os.unlink(filename)
The file can be deleted by either of these commands:
See lessos.remove(filename)
os.unlink(filename)
What are the different stages of the life cycle of a thread?
The different stages of the life cycle of a thread are: Stage 1: Creating a class where we can override the run method of the Thread class. Stage 2: We make a call to start() on the new thread. The thread is taken forward for scheduling purposes. Stage 3: Execution takes place wherein the thread staRead more
The different stages of the life cycle of a thread are: