--- a/basic-data-type/questions.rst Mon Nov 08 02:12:28 2010 +0530
+++ b/basic-data-type/questions.rst Thu Nov 11 02:28:55 2010 +0530
@@ -8,32 +8,72 @@
1. How large can an integer in Python be?
- Any Size.
+ Answer: Any Size.
-2. How do you define a complex number in Python?
+#. How do you define a complex number in Python?
Using the following notation.
[Real part] + [Imaginary part] j
example ::
- c= 3.2 + 4.6j
+ Answer: c= 3.2 + 4.6j
-3. Look at the following piece of code ::
+#. Look at the following piece of code ::
In []: f or t
Out[]:True
What can you comment about the data type of f and t ?
-4. One major diffence between tuples and lists?
+#. One major diffence between tuples and lists?
- Tuples are immutable while lists are not.
+ Answer: Tuples are immutable while lists are not.
+
+
-5. Look at the following sequence ::
+#. Put the following string in a variable quotation.
+ "God doesn't play dice" -Albert Einstein
+
+ quotation='''"God doesn't play dice" -Albert Einstein'''
+
+#. Given a tuple ::
+
+ tup=(7,4,2,1,3,6,5,8)
+ tup[-2]
+
+ 5
+
+.. #[Puneeth: ``Answer: Any size.``. Demarcate the answer from the
+.. question.]
+
+#. What is the syntax for checking containership in Python?::
+
+ element in sequence
+ 'l' in "Hello"
+ True
+
+#. Split this string on whitespaces? ::
+
+ string="Split this string on whitespaces?"
+
+ string.split()
+
+#. What is the answer of 5/2 and 5.0/2 . If yes , why.
+
+ Yes, There is a difference.
+ Because one is integer division and other is float division.
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+
+1. Look at the following sequence ::
In []:t=true
NameError: name 'true' is not defined
@@ -46,49 +86,9 @@
gives a NameError.
-6. Put the following string in a variable quotation.
- "God doesn't play dice" -Albert Einstein
- quotation='''"God doesn't play dice" -Albert Einstein'''
-
-7. Given a tuple ::
-
- tup=(7,4,2,1,3,6,5,8)
- tup[-2]
-
- 5
-
-.. #[Puneeth: ``Answer: Any size.``. Demarcate the answer from the
-.. question.]
-
-8. What is the syntax for checking containership in Python?::
-
- element in sequence
- 'l' in "Hello"
- True
-
-9. Split this string on whitespaces? ::
-
- string="Split this string on whitespaces?"
-
- string.split()
-
-10. What is the answer of 5/2 and 5.0/2 . If yes , why.
-
- Yes, There is a difference.
- Because one is integer division and other is float division.
-
-Larger Questions
-----------------
-
-.. A minimum of 2 questions here (along with answers)
-
-1. Given two lists for example,
- list1=[1,2,3,4] and list2=[1,2,3,4,5,6,7] write a program to remove one list from the other.
-
-.. #[Puneeth: dependency LOs?]
-
-#. Write a program to check if a string is palindrome?
+#. Convert the string "I,learnt,python,through,spoken,tutorial"
+ to "I,learnt through spoken tutorial"
.. #[Puneeth: comparison has not been taught, has it? does this depend
.. on any other LO?]