What Is Python
What Is Python
i. Numbers
ii. Strings
iii. List
iv. Tuples
v. Dictionary
● What are the Tuples in Python?
A) Tuples are immutable collection of values enclosed in parenthesis. They
can be thought of as read-only lists.
● What is a list in Python?
A) List is a mutable collection of values enclosed in square braces. They can
be appended with additional values.
● What is the difference between tuples and lists in Python?
A) List is enclosed in square braces -[] where as tuples are enclosed in curly
braces List is mutable and tuple is immutable.
● What does ** operator do?
A) Performs exponential calculation. 2**3 is similar to 2 to the power of 3, i.e.
8.
● How to check if all the characters in a string are digits?
A) using isDigit() function.
● How to initialize an array with zeros?
A) a = array('i', (0 in range(4)))
● How to reverse a list?
A) list.reverse()
● What is an incomplete function called?
A) Stub
● Does python has a compiler?
A) Yes. Python has a compiler which compiles automatically.'
● What are dictionaries in Python?
A) Dictionaries are similar to hashtable type. They contains key-value pairs.
Dictionaries usually consists of numbers and strings but can be of any type.