Function called lineLengths()

 

Create a function called lineLengths() that has a parameter representing a filename. The function should open the file and then do the following:
• Print: Testing file “ZZZZ”: (where ‘ZZZZ’ is the name of the file). Note that the filename is in quotes. You can also see this in the output example below.
• Place the code where you open the file, read in the information you need, and close the file inside an try/catch exception block. Your exception should catch a FileNotFoundError. If this exception occurs, output: Unable to open the file “ZZZZ”. Program will now terminate. Goodbye! again where ZZZZ is the name of the file. And your function should immediately end.
• If the file has less than 10 lines, your function should simply output: File has only ZZZ lines. Goodbye! (where ZZZ is the number of lines). Your function should then immediately terminate.
• Now if the file being opened has 10 lines or more, you will do the following:
• For each line, output either Short line if the line is less than 25 characters, output Medium line if the line is 25 or more characters, and less than 50 characters, output Long line if the line is 50 or more characters.
• You should do this only for the first 10 lines of the file. So even if the file has many, many lines, only output the values for the first 10 lines.
• Each statement should be preceded by Line #Z: where Z represents the line number. Again, see the sample test output below.
• You should find yourself using format strings for just about all of your print() statements.

 

 

 

Sample Solution

Every Spark application, at its core, comprises of a driver software that performs the user’s primary function and a number of parallel tasks on a cluster. A resilient distributed dataset (RDD), which is a set of elements divided among the cluster’s nodes and capable of being processed in parallel, is the primary abstraction Spark offers. RDDs are made by changing an existing Scala collection in the driver application or a file in the Hadoop file system (or any other file system supported by Hadoop) as the starting point for a new RDD. Additionally, users can request that Spark keep an RDD in memory so that it can be effectively used in several parallel operations. RDDs also automatically restore themselves after node failures.

The term ‘innovation’ is famously challenging to characterize because of the term envelops of an assortment of imaginative and philosophical development which incorporate imagery, futurism, imagism, vorticism information and others. Innovation is a movement of life of a gathering from a collectible or dated way to a better approach for living. The philosophical development emerged from the wide look for alongside social changes in change of the western culture in the nineteenth and twentieth 100 years. It very well may be viewed as an endeavor to shape, or as an ever-evolving pattern that assists people to reshape their current circumstance with the guide of commonsense trial and error, logical information, or innovation. The verifiable variables that impacted innovation include: universal conflict, modern upheaval, new innovation, changes in governmental issues. What’s more, the two expansive developments which is: socially moderate praises man’s capacity to influence the world and the Artistic contemplation a method for handling the new world. WHEN WAS MODERNISM? The foundations of innovation arose in the nineteenth hundred years, in France with Charles Baudelaire in writing, Eduard Manet in painting and Gustave Flaubert in composition fiction. During the 1980s, a strand of reasoning started to state that it was important to get rid of the old standards completely. During the 15yrs of the 20th hundred years, a few journalists, masterminds, craftsmen, made the break with customary method for putting together writing, painting and music. Innovation by and large, incorporates the exercises and manifestations of the people who felt the customary types of craftsmanship, engineering. The pioneer writing was described by a dismissal of the nineteenth century customs and of their agreement among writer and peruser (baldick 159). Innovator attempted to split away from the shows of the Victorian time. They wished to separate themselves from the historical backdrop of workmanship and writing. Ezra Pound with his well known proclamation ‘make it new’ caught the pith of innovation. Consequently, to make a new thing, they needed to make new types of writing.J.M.W Turner being one of the best scene painters of the nineteenth century accepted that his works ought to communicate huge verifiable scholarly or other story subjects dissimilar to the French impressionists who had whimsical equations. Modern unrest significantly affected innovation as certain advancements like steam controlled industrialization helped being developed of railroads what began in Britain in 1830s. Some progression in material science, designing, was likewise an extraordinary accomplishment. The gem royal residence which was the tremendous solid metal and plate display lobby worked for the extraordinary show of 1851 in London. Two of the main masterminds of the period were researcher Charles Darwin (1809-1882), creator of on the beginning of species through regular determination and a political specialist Karl Marx (1818-1883) creator of das capital. Darwin’s hypothesis on regular determination subverted strict conviction and the possibility of human uniqueness. While Marx contends that there were principal s and that laborers were everything except free inside the entrepreneur framework. This gave the ascent to the average workers as the unfortunate ones lived in terrible circumstances while the couple of cream of the benefits.

This question has been answered.

Get Answer
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
👋 Hi, Welcome to Compliant Papers.