Designer vb file not updating

Python Interview Questions # 10) What is the output of the below code?

print(names[-1][-1]) A) The output is: n Python Coding Interview Questions # 12) What is Enumerate() Function in Python?

Python Interview Questions # 8) How can you create Empty Num Py Array In Python?

A) We can create Empty Num Py Array in two ways in Python, 1) import numpy numpy.array([]) 2) numpy.empty(shape=(0,0)) Python Interview Questions # 9) What is a negative index in Python?

A) Num Py arrays are more flexible then lists in Python.

By using Num Py arrays reading and writing items is faster and more efficient.

A) Yes, we can use a global variable in other functions by declaring it as global in each function that assigns to it: globvar = 0 def set_globvar_to_one(): global globvar # Needed to modify global copy of globvar globvar = 1 def print_globvar(): print globvar # No need for global declaration to read value of globvar set_globvar_to_one() print_globvar() # Prints 1 Python Coding Interview Questions # 18) What is the output of the program?

print(objects) print(len(objects)) # Use of “in” keyword.

Example: def testgen(index): weekdays = [‘sun’,’mon’,’tue’,’wed’,’thu’,’fri’,’sat’] yield weekdays[index] yield weekdays[index 1] day = testgen(0) print next(day), next(day) Output: sun mon Python Interview Questions # 3) How to convert a list into a string?

A) When we want to convert a list into a string, we can use the method which joins all the elements into one and returns as a string.

A) User can convert list into set by using function.

Example: weekdays = [‘sun’,’mon’,’tue’,’wed’,’thu’,’fri’,’sat’,’sun’,’tue’] list As Set = set(weekdays) print(list As Set) output: set([‘wed’, ‘sun’, ‘thu’, ‘tue’, ‘mon’, ‘fri’, ‘sat’]) Python Interview Questions # 6) How to count the occurrences of a perticular element in the list?

Leave a Reply