summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lstsq.rst21
-rw-r--r--parsing_data.rst81
-rw-r--r--tuples.rst56
3 files changed, 156 insertions, 2 deletions
diff --git a/lstsq.rst b/lstsq.rst
index 5b375d3..7af7701 100644
--- a/lstsq.rst
+++ b/lstsq.rst
@@ -109,7 +109,6 @@ We get the least square fit of l vs t^2
This brings us to the end of the tutorial.
we have learnt
- * how to use loadtxt to read files
* how to generate a least square fit
{{{ Show the "sponsored by FOSSEE" slide }}}
@@ -119,4 +118,22 @@ This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
Hope you have enjoyed and found it useful.
Thank you
-
+
+Questions
+=========
+
+ 1. What does ones_like([1, 2, 3]) produce
+
+ a. array([1, 1, 1])
+ #. [1, 1, 1]
+ #. [1.0, 1.0, 1.0]
+ #. Error
+
+ 2. What does ones_like([1.2, 3, 4, 5]) produce
+
+ a. [1.2, 3, 4, 5]
+ #. array([1.0, 1.0, 1.0, 1.0])
+ #. array([1, 1, 1, 1])
+ #. array([1.2, 3, 4, 5])
+
+ 3. What is the shape of the
diff --git a/parsing_data.rst b/parsing_data.rst
index 9a7f85f..17e1d4d 100644
--- a/parsing_data.rst
+++ b/parsing_data.rst
@@ -204,3 +204,84 @@ This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
Hope you have enjoyed and found it useful.
Thank you
+Questions
+=========
+
+ 1. How do you split the string "Guido;Rossum;Python" to get the words
+
+ Answer: line.split(';')
+
+ 2. line.split() and line.split(' ') are same
+
+ a. True
+ #. False
+
+ Answer: False
+
+ 3. What is the output of the following code::
+
+ line = "Hello;;;World;;"
+ sub_strs = line.split()
+ print len(sub_strs)
+
+ Answer: 5
+
+ 4. What is the output of " Hello World ".strip()
+
+ a. "Hello World"
+ #. "Hello World"
+ #. " Hello World"
+ #. "Hello World "
+
+ Answer: "Hello World"
+
+ 5. What does "It is a cold night".strip("It") produce
+ Hint: Read the documentation of strip
+
+ a. "is a cold night"
+ #. " is a cold nigh"
+ #. "It is a cold nigh"
+ #. "is a cold nigh"
+
+ Answer: " is a cold nigh"
+
+ 6. What does int("20") produce
+
+ a. "20"
+ #. 20.0
+ #. 20
+ #. Error
+
+ Answer: 20
+
+ 7. What does int("20.0") produce
+
+ a. 20
+ #. 20.0
+ #. Error
+ #. "20"
+
+ Answer: Error
+
+ 8. What is the value of float(3/2)
+
+ a. 1.0
+ #. 1.5
+ #. 1
+ #. Error
+
+ Answer: 1.0
+
+ 9. what doess float("3/2") produce
+
+ a. 1.0
+ #. 1.5
+ #. 1
+ #. Error
+
+ Answer: Error
+
+ 10. See if there is a function available in pylab to calculate the mean
+ Hint: Use tab completion
+
+
diff --git a/tuples.rst b/tuples.rst
index 1a6cf7f..e6c060c 100644
--- a/tuples.rst
+++ b/tuples.rst
@@ -148,3 +148,59 @@ Thankyou
Internal Reviewer 1 :
Internal Reviewer 2 :
External Reviewer :
+
+Questions
+=========
+
+ 1. Define a tuple containing two values. The first being integer 4 and second
+ is a float 2.5
+
+ Answer: (4, 2.5)
+
+ 2. If ``a = (5, "Hello", 3.2)``. what is the value of a[2]
+
+ Answer: 3.2
+
+ 3. If ``a = 5,`` then what is the type of a
+
+ a. int
+ #. float
+ #. tuple
+ #. string
+
+ Answer: tuple
+
+ 4. if ``a = (2, 3)``. What does ``a[0], a[1] = (3, 4)`` produce
+
+ Answer: Error
+
+ 5. If ``a = ([2, 3], 4, 5)``. What is the value of ``a`` after doing
+ ``a[0].append(6)``
+
+ a. ([2, 3, 6], 4, 5)
+ #. Raises an error
+ #. ([2, 3], 4, 5)
+ #. [2, 3, 4, 5, 6]
+
+ Answer: ([2, 3, 6], 4, 5)
+
+ 6. What does the following code produce::
+
+ a = 5
+ b = "Hello"
+ a, b = b, a
+ print a
+ print b
+
+ Answer: Hello
+ 5
+
+ 7. ``a = ("hello", "world", 5, 6, 8)``. What is the value of a[1:4]
+
+ Answer: ("world", 5, 6)
+
+ 8. ``a = (1, 2, 3, 4, 5, 6, 7, 8)``. What is the value of a[1::3]
+
+ Answer: (2, 5, 8)
+
+