>
Practice Assignments
Adapted from "The Colors of Animals" by Sir John Lubbock in A Book of Natural History (1902, ed. David Starr Jordan)
The color of animals is by no means a matter of chance; it depends on many considerations, but in the majority of cases tends to protect the animal from danger by rendering it less conspicuous. Perhaps it may be said that if coloring is mainly protective, there ought to be but few brightly colored animals. There are, however, not a few cases in which vivid colors are themselves protective. The kingfisher itself, though so brightly colored, is by no means easy to see. The blue harmonizes with the water, and the bird as it darts along the stream looks almost like a flash of sunlight.
Desert animals are generally the color of the desert. Thus, for instance, the lion, the antelope, and the wild donkey are all sand-colored. “Indeed,” says Canon Tristram, “in the desert, where neither trees, brushwood, nor even undulation of the surface afford the slightest protection to its foes, a modification of color assimilated to that of the surrounding country is absolutely necessary. Hence, without exception, the upper plumage of every bird, and also the fur of all the smaller mammals and the skin of all the snakes and lizards, is of one uniform sand color.”
The next point is the color of the mature caterpillars, some of which are brown. This probably makes the caterpillar even more conspicuous among the green leaves than would otherwise be the case. Let us see, then, whether the habits of the insect will throw any light upon the riddle. What would you do if you were a big caterpillar? Why, like most other defenseless creatures, you would feed by night, and lie concealed by day. So do these caterpillars. When the morning light comes, they creep down the stem of the food plant, and lie concealed among the thick herbage and dry sticks and leaves, near the ground, and it is obvious that under such circumstances the brown color really becomes a protection. It might indeed be argued that the caterpillars, having become brown, concealed themselves on the ground, and that we were reversing the state of things. But this is not so, because, while we may say as a general rule that large caterpillars feed by night and lie concealed by day, it is by no means always the case that they are brown; some of them still retaining the green color. We may then conclude that the habit of concealing themselves by day came first, and that the brown color is a later adaptation.
The example of the mature caterpillar in the third paragraph is primarily intended to demonstrate
b) Now, create this as a function and apply this to all the files in a given directory.
If there are 10 files called
a. txt
b. txt
then, we should have
sorted_a.txt
sorted_b.txt
sorted_c.txt
c) Merge all these files into one single sorted set of words which have unique words. This may be called sorted_20200326.txt
ie. sorted_yyyymmdd.txt
a. Create a list months=[Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec] b. Create a list days=[31,28,31,30,31,30,31,31,30,31,30,31] c. Output to be as below Jan 1 Jan 2 Jan 3 d. Output to be as below Wed, Jan 1, 2025 Thu, Jan 2, 2025 Fri, Jan 3, 2025 e. If your country has holiday on Sundays, mention it Wed, Jan 1, 2025 Thu, Jan 2, 2025 Fri, Jan 3, 2025 Sat, Jan 4, 2025 Sun, Jan 5, 2025 - Holiday f. Read file holidays.txt and mark the holidays against the applicable days Wed, Jan 1, 2025 Thu, Jan 2, 2025 Fri, Jan 3, 2025 Sat, Jan 4, 2025 Sun, Jan 5, 2025 - Weekly Holiday Sat, Jan 6, 2025 Sat, Jan 7, 2025 Sat, Jan 8, 2025 Sat, Jan 9, 2025 Sat, Jan 10, 2025 Sat, Jan 11, 2025 Sat, Jan 12, 2025 - Weekly Holiday Sat, Jan 13, 2025 Sat, Jan 14, 2025 - Makara Sankranthi