author | Anoop Jacob Thomas<anoop@fossee.in> |
Sun, 07 Nov 2010 19:47:26 +0530 | |
changeset 399 | 3c16961361cd |
parent 372 | 8e05616c4102 |
child 416 | 06ac45f4de88 |
permissions | -rw-r--r-- |
322 | 1 |
Objective Questions |
2 |
------------------- |
|
3 |
||
4 |
.. A mininum of 8 questions here (along with answers) |
|
5 |
||
6 |
1. How do you declare a sequence of numbers in python? |
|
7 |
Give example . |
|
8 |
||
9 |
Comma seperated numbers inside two square brackets. |
|
10 |
||
11 |
seq=[1.5,3.2,8.7] |
|
12 |
||
13 |
||
14 |
2. Square the following sequence? |
|
15 |
||
16 |
distance_values=[2.1,4.6,8.72,9.03]. |
|
17 |
||
18 |
square(distance_values) |
|
19 |
||
20 |
||
21 |
||
22 |
3. How do you plot points ? |
|
23 |
||
24 |
By passing an extra parameter '.'. |
|
25 |
||
399
3c16961361cd
reviewed plotting-data.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
372
diff
changeset
|
26 |
.. #[[Anoop: It can better if asked as, How do you plot the data as |
3c16961361cd
reviewed plotting-data.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
372
diff
changeset
|
27 |
points using plot function?]] |
3c16961361cd
reviewed plotting-data.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
372
diff
changeset
|
28 |
|
322 | 29 |
4. What does the parameter 'o' do ? |
30 |
||
31 |
It plots large points. |
|
32 |
||
399
3c16961361cd
reviewed plotting-data.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
372
diff
changeset
|
33 |
.. #[[Anoop: give an example and ask what it does, like plot(x, y, |
3c16961361cd
reviewed plotting-data.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
372
diff
changeset
|
34 |
'o'), that makes the question simple]] |
3c16961361cd
reviewed plotting-data.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
372
diff
changeset
|
35 |
|
322 | 36 |
5. How do you plot error in Python? |
37 |
||
38 |
Using the function error bar. |
|
39 |
||
40 |
6. How do I get large red colour dots on a plot? |
|
41 |
||
42 |
By passing the paramter 'ro'. |
|
43 |
||
44 |
7. What are the parameters 'xerr' and 'yerr' in errorbar function for? |
|
45 |
||
46 |
xerr - List of error values of variable on x axis. |
|
47 |
yerr - List of error values of variable on y ayis. |
|
48 |
||
49 |
8. How would you plot error bar with a line? |
|
50 |
||
51 |
The fmt parameter for a line will be '-'. |
|
52 |
||
53 |
||
54 |
||
55 |
||
56 |
Larger Questions |
|
57 |
---------------- |
|
58 |
||
59 |
.. A minimum of 2 questions here (along with answers) |
|
60 |
||
372 | 61 |
1. Plot an errorbar for following experimental data. |
62 |
||
63 |
| X | Y | Xerr | Yerr | |
|
64 |
| 154.9 | 8106 | 8.51 | 165.8 | |
|
65 |
| 154.3 | 8138 | 8.50 | 166.3 | |
|
66 |
| 148.7 | 8148 | 7.78 | 161.2 | |
|
67 |
| 149.6 | 8171 | 7.81 | 162.6 | |
|
68 |
||
69 |
in red colour with large dots |
|
70 |
||
71 |
2. List the parameters for errorbar and their function? |