These sound like homework questions, in which case it would not be right for
us to just give you the answer (and it would not be right for you to ask for
it).

If you can show us what you have tried so far, maybe we can give you some
hints ...

________________________________

        From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Natasha Menon
        Sent: 08 February 2006 17:19
        To: tutor@python.org
        Subject: [Tutor] python help
        
        
        Hi,
         
        I have a few doubts in python programming. C if any of u can help me
out. 
         
        1. 
        In a file called string_stuff.py i have to write a function called
frequencies that takes a string as a parameter and returns a dictionary
where the keys are the characters from the string and each value is an
integer indicating the number of times the key appeared in the string. 
         
        2.
        Similary in the same file string_stuff.py, have to write a function
called locations that takes a string as a parameter and returns a dictionary
where the keys are the characters from the string and each value is a list
indicating the indices in the string at which the key appears, sorted in
increasing order.
         
        3.
        In the same file string_stuff.py, write a function called
concordance that takes an open file as a parameter and returns a dictionary
where the keys are the strings from the file and each value is a list of
line numbers of the lines in which the key appeared, sorted in increasing
order. Start counting at 0. Each line number should appear at most once in a
list, even if a word appears twice on a line. You may assume that the input
consists only of alphabetic letters (a-z, A-Z) and whitespace. 
         
         
        Id really appreciate if you could help me on these small question. I
am tryin to learn to program in python.
         
        Thanks,
        Natasha
        

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to