No one is unaware of the name of that famous English shipowner, Cunard. In 1840 this shrewd industrialist founded a postal service between Liverpool and Halifax, featuring three wooden ships with 400-horsepower paddle wheels and a burden of 1,162 metric tons. Eight years later, the company’s assets were increased by four 650-horsepower ships at 1,820 metric tons, and in two more years, by two other vessels of still greater power and tonnage. In 1853 the Cunard Co., whose mail-carrying charter had just been renewed, successively added to its assets the Arabia, the Persia, the China, the Scotia, the Java, and the Russia, all ships of top speed and, after the Great Eastern, the biggest ever to plow the seas. So in 1867 this company owned twelve ships, eight with paddle wheels and four with propellers. If I give these highly condensed details, it is so everyone can fully understand the importance of this maritime transportation company, known the world over for its shrewd management. No transoceanic navigational undertaking has been conducted with more ability, no business dealings have been crowned with greater success. In twenty-six years Cunard ships have made 2,000 Atlantic crossings without so much as a voyage canceled, a delay recorded, a man, a craft, or even a letter lost. Accordingly, despite strong competition from France, passengers still choose the Cunard line in preference to all others, as can be seen in a recent survey of official documents. Given this, no one will be astonished at the uproar provoked by this accident involving one of its finest steamers.py (30 points)
Write a program that will except a range of 20 numbers from the user and then populate the list with entered numbers. It will also calculate the min. max, total, and average (math functions) of those numbers.
Hints:
Define main () program
Create number_list (This list will contain how many number you want your program to loop through)
Declare variables
Use a For loop to populate the number_list.
Print out the min. max, total, and average formatted with 2 decimal precisions.
py (40 points):
Write a program that will read a data file calculates which contains sentences (text file). Then count the total number of words in the file. Calculate the average and print it out.
Hints:
Define main() program
Declare variables
Save the given data file under the same folder as your program file is
Open file
User infile.readlines() to read data into a list of sentences (Each item in the list is one sentence)
Use len(sentence_list) to get length of the sentence list. (num of sentence is equal to the length of sentence list
Use a For loop to number of items (word) in the sentence. For loop will collect the Total words.
Calculate the average and print
py (30 point)
Write a program to read a text file. Determine if the character is uppercase, lowercase, a digit, or space, and keep a running total of each.
Hints
Define main() program
Declare variables
Save the given data file under the same folder as your program file is.
Open file
Use a For loop to read data and verify with if statement or if/elif statement
Print out the total of is uppercase, lowercase, a digit, and space characters in the file
Recent Comments