On this tutor list, we're not able to provide solutions to assignments
or homework, but I'll help as I can. I'm also forwarding this to the
list, as other people can probably help better than I.<br>
<br>
The problem you've been given is simple, (well, the Python bit is), but they haven't explained it very well. <br>
<br>
Check out this - <a href="http://www.freenetpages.co.uk/hp/alan.gauld/">http://www.freenetpages.co.uk/hp/alan.gauld/</a><br>
<br>
It's a tutorial written by Alan Gauld, who answers emails on this list, look under - <br>
&quot;The Raw Materials&quot; and read about collections, as this is what your problem involves ( I assume you are ok with HTML.... :/)<br>
<br>
<br>
So, in your assignment, each cheque's details will look like this - <br>
<br>
&gt;&gt;&gt; cheque = [ 1, 12.00, &quot;foo&quot; ]<br>
<br>
The&nbsp; [ ] bits mean that cheque is a list containing 1, 12.00 and &quot;foo&quot; as values. <br>
<br>
(You might want to play around with the Python interpreter.)<br>
<br>
Ok... that part is reasonably straight forward. Now, you can access each item in a list by using it's index. <br>
<br>
Remember that computers start counting at 0... ask a computer to count
to ten and it will count 0,1,2,3,4,5,6,7,8,9 ....so, the 1st item of a
list is actually item zero.<br>
<br>
Ok. So, to access the first item of cheque, you would do something like this at the Python prompt - <br>
<br>
&gt;&gt;&gt; print cheque[0] <br>
1<br>
&gt;&gt;&gt;print cheque[1]<br>
12.00<br>
&gt;&gt;&gt;print cheque[2]<br>
foo<br>
<br>
Does that make sense?<br>
<br>
You can also have a list of lists. <br>
<br>
&gt;&gt;&gt; manyCheques = [ [ 1, 12.00, &quot;foo&quot;], [2, 13.88, &quot;bar&quot;] ]<br>
<br>
Now, if you print the first item of manyCheques like so <br>
<br>
&gt;&gt;&gt;print manyCheques[0]<br>
[1, 12.00, &quot;foo&quot;]<br>
<br>
So, the first item of manyCheques is a list too, (the square brackets.)<br>
<br>
So how to access the third item of the second list?<br>
<br>
&gt;&gt;&gt; print manyCheques[1][2] (remember, computers start at 0)<br>
bar<br>
<br>
It's just a shorthand way of saying &quot;print the 3rd item of the 2nd item of manyCheques&quot;.<br>
<br>
Um...<br>
<br>
You'll also need to learn a wee bit about looping, so I really do suggest starting with Alan's tutorial.<br>
<br>
Good luck, <br>
<br>
<br><br><div><span class="gmail_quote">On 7/21/05, <b class="gmail_sendername">dina lenning</b> &lt;<a href="mailto:dlenning@shaw.ca">dlenning@shaw.ca</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
YES...heres my problem<br><br>&nbsp;&nbsp;I am a university student..will be a teacher in 2 years hopefully..and<br>have taken a first year computing course that said it required NO PRIOR<br>knowledge, but i am having great difficulty. The students (71 of them)
<br>are all complaining, including myself , as we all find it too hard.<br>Anyway..i am having a heck of a time, but can not fail becasue i am on<br>student loans. I am looking for help for this assignment:<br><a href="http://www.cs.sfu.ca/CC/165/popowich/assign-1/assign4">
http://www.cs.sfu.ca/CC/165/popowich/assign-1/assign4</a><br>also, do you think this is easy and should it be in a first year, no<br>prior knowledge course??<br>Even if you can guide me to some resources that may help me work this
<br>out that would be great. Thank you.<br>You could even just send the assignment code if you want :)<br>thanks dina<br>On 20-Jul-05, at 4:04 PM, Liam Clarke wrote:<br><br>&gt; Most likely. Are they questions regarding Python?
<br>&gt;<br>&gt; On 7/21/05, dina lenning &lt;<a href="mailto:dlenning@shaw.ca">dlenning@shaw.ca</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; Tutor <a href="mailto:maillist-Tutor@python.org">
maillist-Tutor@python.org</a><br>&gt;&gt;&nbsp;&nbsp;<a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a><br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; 'There is only one basic human right, and that is to do as you damn
<br>&gt; well please.<br>&gt; And with it comes the only basic human duty, to take the consequences.'<br></blockquote></div><br><br><br>-- <br>'There is only one basic human right, and that is to do as you damn well please.
<br>And with it comes the only basic human duty, to take the consequences.'