homework, Basic Computer Science

#questioPurpose of this assignment:
1. Using dictionaries.
Write a program to read a text file and create a dictionary. The keys for the dictionary should be all 26 letters of the alphabet and the values of the dictionary should be the list of all the words which start with the corresponding letter.
The input text file name is: "student_grades_hm_6.txt". Here is a sample input file.
Notice that this is just a sample file and your program must work with other sample files.
General Requirements
• At the top of your program, as a comment, include the following information: (you need to replace the "xxx" with an appropriate number or string)
• Your name (last_name, first_name)
• Your student ID (1000-xxx-xxx)
• Date of submission (yyyy-mm-dd)
• Homework #
• I spent xxx hours on this assignment
• I rate the difficulty level of this assignment as : xxx {a number between 1 and 10. (10 is the hardest)}
• I rate the speed of the coverage of material in this course as: xxx {a number between 1 and 10. (10 is too fast)}
• My comment about this assignment and the course: xxx [Optional comment]
Rules for naming variables and commenting your program:
• You must include proper comments in your program.
• Any variable that you use in your program must have a descriptive name (do not use variable names such as "x")
• Append the type of the variable to the end of the variable using an underscore. For example (grades_list, average_float, name_str).
• If the type of a variable may change in the run time, then append "_mix" at the end of the variable name.
For example (for element_mix in ["yes", "no" , 1, 6]).
• Do NOT use all uppercase letters to name a variable. All uppercase variable names all primarily used for constants.
Notes about input and output
• You MUST use dictionaries.
• The input file may contain other characters such as numbers, punctuation marks, math symbols, ...
• Your program should ignore all other characters (other than alphabetic characters)
• Convert all upper case letters to lower case
• Ignore one letter words such as "a"
• The list of words in the output should be sorted
Sample Input Output
Assuming that the input file "student_grades_hm_6.txt" contains the following text:
And he said:
Your children are not your children.
They are the sons and daughters of Life''s longing for itself.
They come through you but not from you,
And though they are with you, yet they belong not to you.
You may give them your love but not your thoughts.
For they have their own thoughts.
You may house their bodies but not their souls,
For their souls dwell in the house of tomorrow, which you cannot visit, not even in your dreams.
You may strive to be like them, but seek not to make them like you.
For life goes not backward nor tarries with yesterday.
You are the bows from which your children as living arrows are sent forth.
The archer sees the mark upon the path of the infinite, and He bends you with His might that His arrows may go swift and far.
Let your bending in the archer''s hand be for gladness;
For even as he loves the arrow that flies, so He loves also the bow that is stable.
"Khalil Gibran"
Your program''s output should be:
There are 7 words starting with letter " a " :
also , and , archer , are , arrow , arrows , as
There are 9 words starting with letter " b " :
backward , be , belong , bending , bends , bodies , bow , bows , but
There are 3 words starting with letter " c " :
cannot , children , come
There are 3 words starting with letter " d " :
daughters , dreams , dwell
There are 1 words starting with letter " e " :
There are 5 words starting with letter " f " :
far , flies , for , forth , from
There are 5 words starting with letter " g " :
gibran , give , gladness , go , goes
There are 5 words starting with letter " h " :
hand , have , he , his , house
There are 4 words starting with letter " i " :
in , infinite , is , itself
There are 1 words starting with letter " k " :
There are 7 words starting with letter " l " :
let , life , like , living , longing , love , loves
There are 4 words starting with letter " m " :
make , mark , may , might
There are 2 words starting with letter " n " :
nor , not
There are 2 words starting with letter " o " :
of , own
There are 1 words starting with letter " p " :
There are 10 words starting with letter " s " :
said , seek , sees , sent , so , sons , souls , stable , strive , swift
There are 11 words starting with letter " t " :
tarries , that , the , their , them , they , though , thoughts , through , to , tomorrow
There are 1 words starting with letter " u " :
There are 1 words starting with letter " v " :
There are 2 words starting with letter " w " :
which , with
There are 4 words starting with letter " y " :
yesterday , yet , you , your

Posted Date: 10/20/2012 4:28:27 PM | Location : United States

Related Discussions:- homework, Assignment Help, Ask Question on homework, Get Answer, Expert's Help, homework Discussions

Write discussion on homework
Your posts are moderated
Related Questions
They are used to reduce or enlarge the content of the counters. DEC INC DEC INSTRUCTION Idea: To diminish the operator. Syntax: DEC destiny This action subtracts 1 from the destiny

i have an android app which uses a database file called question db which is stored in the assets file. I have tried a database example called android application development but f

There are two kinds of procedures, the intrasegments, which are found on the similar segment of instructions and the inter-segments which can be stored on dissimilar memory segment

Which applications require TCP and why? Also specify which applications require UDP and why? A4) TCP is also known as connection-oriented: setup required between client and server

Bidirectional Search-Artificial intelligence: We've concentrated so far on searches where the point of the search is to search a solution, not the path to the solution. In anot

how to measure marginal utility.?

Memory Management: The purpose of the memory management system is to load programs into memory in such a way as to give each program loaded  the memory that it requires for

1. In each of the following situations, indicate whether f = O(g), or f = O(g), or both (in which case f = T(g)). Briefly explain why. (a) f(n)=10n5 +8n2,g(n)=20n4 +7n3 +300 (b) f

I n t e rnal Structure of Agents We have looked at agents in terms of their external influences and behaviors: they take input from the environment and perform rational act

Machines which exhibit intelligent nature Machines in this case could easily be personal computers, or they could be robots with embedded systems, or a combination of both. Wh