diff options
author | Nishanth Amuluru | 2010-10-06 15:38:54 +0530 |
---|---|---|
committer | Nishanth Amuluru | 2010-10-06 15:38:54 +0530 |
commit | 8ddc479f7129333d5eae440f0173c283507f678a (patch) | |
tree | 1059508155a0664bad88ffcb60a3f1ac7a57e130 /parsing_data.rst | |
parent | b6cb6dd8a5936cc640cadfc47961b0cbcc7c6ae5 (diff) | |
download | st-scripts-8ddc479f7129333d5eae440f0173c283507f678a.tar.gz st-scripts-8ddc479f7129333d5eae440f0173c283507f678a.tar.bz2 st-scripts-8ddc479f7129333d5eae440f0173c283507f678a.zip |
added questions
Diffstat (limited to 'parsing_data.rst')
-rw-r--r-- | parsing_data.rst | 81 |
1 files changed, 81 insertions, 0 deletions
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 + + |