10.15. Chapter AssessmentΒΆ

Data file: travel_plans.txt
This summer I will be travelling.
I will go to...
Italy: Rome
Greece: Athens
England: London, Manchester
France: Paris, Nice, Lyon
Spain: Madrid, Barcelona, Granada
Austria: Vienna
I will probably not even want to come back!
However, I wonder how I will get by with all the different languages.
I only know English!
Data file: school_prompt.txt
Writing essays for school can be difficult but
many students find that by researching their topic that they
have more to say and are better informed. Here are the university
we require many undergraduate students to take a first year writing requirement
so that they can
have a solid foundation for their writing skills. This comes
in handy for many students.
Different schools have different requirements, but everyone uses
writing at some point in their academic career, be it essays, research papers,
technical write ups, or scripts.
Data file: emotion_words.txt
Sad upset blue down melancholy somber bitter troubled
Angry mad enraged irate irritable wrathful outraged infuriated
Happy cheerful content elated joyous delighted lively glad
Confused disoriented puzzled perplexed dazed befuddled
Excited eager thrilled delighted
Scared afraid fearful panicked terrified petrified startled
Nervous anxious jittery jumpy tense uneasy apprehensive
The textfile, travel_plans.txt, contains the summer travel plans for someone with some commentary. Find the total number of characters in the file and save to the variable num.
We have provided a file called emotion_words.txt that contains lines of words that describe emotions. Find the total number of words in the file and assign this value to the variable num_words.
Assign to the variable num_lines the number of lines in the file school_prompt.txt.
Assign the first 30 characters of school_prompt.txt as a string to the variable beginning_chars.
Challenge: Using the file school_prompt.txt, assign the third word of every line to a list called three.
Challenge: Create a list called emotions that contains the first word of every line in emotion_words.txt.
Assign the first 33 characters from the textfile, travel_plans.txt to the variable first_chars.
Challenge: Using the file school_prompt.txt, if the character β€˜p’ is in a word, then add the word to a list called p_words.
Next Section - 10.16. πŸ€” Exploring Common Words and SETI