author | Amit Sethi |
Tue, 09 Nov 2010 23:18:57 +0530 | |
changeset 432 | c92662f02209 |
parent 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 |
||
416 | 22 |
3. How do you plot the data as points using plot function? |
322 | 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 |
|
416 | 29 |
4. Can you comment about the result of this plot command . |
30 |
plot(x, y,'o') |
|
31 |
||
322 | 32 |
|
33 |
It plots large points. |
|
34 |
||
399
3c16961361cd
reviewed plotting-data.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
372
diff
changeset
|
35 |
.. #[[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
|
36 |
'o'), that makes the question simple]] |
3c16961361cd
reviewed plotting-data.
Anoop Jacob Thomas<anoop@fossee.in>
parents:
372
diff
changeset
|
37 |
|
322 | 38 |
5. How do you plot error in Python? |
39 |
||
40 |
Using the function error bar. |
|
41 |
||
42 |
6. How do I get large red colour dots on a plot? |
|
43 |
||
44 |
By passing the paramter 'ro'. |
|
45 |
||
46 |
7. What are the parameters 'xerr' and 'yerr' in errorbar function for? |
|
47 |
||
48 |
xerr - List of error values of variable on x axis. |
|
49 |
yerr - List of error values of variable on y ayis. |
|
50 |
||
51 |
8. How would you plot error bar with a line? |
|
52 |
||
53 |
The fmt parameter for a line will be '-'. |
|
54 |
||
55 |
||
56 |
||
57 |
||
58 |
Larger Questions |
|
59 |
---------------- |
|
60 |
||
61 |
.. A minimum of 2 questions here (along with answers) |
|
62 |
||
372 | 63 |
1. Plot an errorbar for following experimental data. |
64 |
||
65 |
| X | Y | Xerr | Yerr | |
|
66 |
| 154.9 | 8106 | 8.51 | 165.8 | |
|
67 |
| 154.3 | 8138 | 8.50 | 166.3 | |
|
68 |
| 148.7 | 8148 | 7.78 | 161.2 | |
|
69 |
| 149.6 | 8171 | 7.81 | 162.6 | |
|
70 |
||
71 |
in red colour with large dots |
|
72 |
||
73 |
2. List the parameters for errorbar and their function? |