Extra ExercisesΒΆ

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!
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.
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
  1. The textfile, files_extra.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.

1.1 Using the file school_prompt.txt, find the number of characters and assign that value to the variable num_char.

1.2 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.

  1. Now, find the number of lines in the file, files_extra.txt, and assign it to the variable num_lines.

2.1 Assign to the variable num_lines the number of lines in the file school_prompt.txt.

2.2 Write code to find out how many lines are in the file emotion_words.txt. Save this value to the variable num_lines.

  1. Assign the first 30 characters of school_prompt.txt as a string to the variable beginning_chars.

3.2 Create a string called first_forty that is comprised of the first 40 characters of emotion_words.txt.

  1. Challenge Create a list called destination. If the line in the file files_extra.txt has a colon (:), append that line to the list.

4.1 Challenge: Using the file school_prompt.txt, assign the third word of every line to a list called three.

4.2 Challenge: Create a list called emotions that contains the first word of every line in emotion_words.txt.

  1. Assign the first 33 characters from the textfile, files_extra.txt to the variable first_chars.

5.1 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.

5.2 Challenge: Create a list called j_emotions that contains every word in emotion_words.txt that begins with the letter “j”.

Next Section - Understanding Code