what gets printed? Assuming python version 2.x
print type(1/2)
Result: 213 questions
what gets printed? Assuming python version 2.x
print type(1/2)
what gets printed? Assuming python version 3.x
print (type(1/2))
If PYTHONPATH is set in the environment, which directories are searched for modules?
A) PYTHONPATH directory
B) current directory
C) home directory
D) installation dependent default path
In python 2.6 or earlier, the code will print error type 1 if accessSecureSystem raises an exception of either AccessError type or SecurityError type
try:
accessSecureSystem()
except AccessError, SecurityError:
print "error type 1"
continueWork()
Assuming python 2.6 what gets printed?
f = None
for i in range (5):
with open("data.txt", "w") as f:
if i > 2:
break
print f.closed
What gets printed?
Assume Python 2
print "hello" 'world'
Assuming the filename for the code below is /usr/lib/python/person.py
and the program is run as:
python /usr/lib/python/person.py
What gets printed?
class Person:
def __init__(self):
pass
def getAge(self):
print __name__
p = Person()
p.getAge()
Asume Python 2
How do you create a package so that the following reference will work?
p = mytools.myparser.MyParser()
Assuming python 2.x, what gets printed?
x = 0
y = 1
a = cmp(x,y)
if a < x:
print "a"
elif a == x:
print "b"
else:
print "c"
What gets printed (with python version 2.X) assuming the user enters the following at the prompt?
#: foo
a = input("#: ")
print a
What gets printed (with python version 3.X) assuming the user enters 'foo' at the prompt?
a = input("#: ")
print (a)
What is the type of b(Python 3)?
a = -1
b = a ** 0.5
What is the type of a(Python 3)?
a = 10/5
In the Django Template Language, the {% ... %} notation provides for the inclusion of arbitrary Python code, with structures like 'for', 'if', etc.
Is There A Switch Or Case Statement In Python? If Not Then What Is The Reason For The Same?
Answer:
No, Python does not have a Switch statement, but you can write a Switch function and then use it.
What Are The Optional Statements That Can Be Used Inside A <Try-Except> Block In Python?
Answer:
There are two optional clauses you can use in the <try-except> block.
What Are Different Methods To Copy An Object In Python?
Answer:
There are two ways to copy objects in Python.
What Is The Purpose Of Doc Strings In Python?
Answer:
In Python, documentation string is popularly known as doc strings. It sets a process of recording Python functions, modules, and classes.
How Do You Debug A Program In Python? Is It Possible To Step Through Python Code?
Answer:
Yes, we can use the Python debugger (<pdb>) to debug any Python program. And if we start a program using <pdb>, then it let us even step through the code.
List Down Some Of The PDB Commands For Debugging Python Programs?
Answer:
Here are a few PDB commands to start debugging Python code.
© 2017 QuizBucket.org