Question

In: Computer Science

In Python Please Dennis has always loved music, and recently discovered a fascinating genre. Tautograms are...

In Python Please
Dennis has always loved music, and recently discovered a fascinating genre. Tautograms are a special case of alliteration, which is the appearance of the same letter at the beginning of adjacent words. In particular, a sentence is a tautogram if all its words begin with the same letter.

For example, the following sentences are tautograms. French flowers bloom, Sam Serrano whistles softly, Pedro ordered pizza. Dennis wants to dazzle his wife with a romantic letter full of these kinds of prayers. Help Dennis check if each sentence he wrote is a tautogram or not. Input

Format Each test case is made up of a single line that contains a sentence. A sentence consists of a sequence of up to 50 words separated by individual spaces. A word is a sequence of up to 20 contiguous uppercase and lowercase letters of the English alphabet.

A word contains at least one letter and a sentence contains at least one word. The last test case is followed by a line containing a single character "*" (asterisk). Constraints For each test case, generate a single line that contains an uppercase "Yes" if the sentence is a tautogram, or an uppercase "No" otherwise.

Output Format "Yes or no"

Solutions

Expert Solution

#CODE TO COPY MAKE SURE INDENTATION IS CORRECT

def check_tautogram(sentence):
#spliting input sentense into words
words = sentence.split()
#getting first letter of first word
first_letter = words[0][0].lower()
check = True
#checking weather all the words haaving the same letter or not
for i in words:
if (i[0].lower() != first_letter):
check = False
break
if check:
return 'Y'
else:
return 'N'
sentence = input()
while sentence != "*":
print (check_tautogram(sentence))
sentence = input()


Related Solutions

Eleanor has always loved working with patients at a large cancer center in her city. Recently,...
Eleanor has always loved working with patients at a large cancer center in her city. Recently, however, you have noticed that the loss of one particular patient, Maria, has really been quite a blow for Eleanor. This is not the usual response Eleanor has to a patient’s death, and having worked at the center for 8 years, she has experienced her share of patient deaths. After Maria’s death, Eleanor wrote a brief post on her Facebook page saying, “Lost a...
Mary Ann has always loved to cook and is interested in starting a catering business. Being...
Mary Ann has always loved to cook and is interested in starting a catering business. Being aware of the failure rate of new businesses, she is considering buying an existing catering business that is up for sale. The current owners claim that the business is highly profitable, but Mary Ann has her doubts. She wonders why the owners would be so interested in selling the business if it is such a money maker. Furthermore, the price that they are asking...
no excel please The Pet Company has recently discovered a type of rock which, when crushed,...
no excel please The Pet Company has recently discovered a type of rock which, when crushed, is extremely absorbent.  It is expected that the firm will experience (beginning now) an unusually high growth rate (40%) during the period (3 years) when it has exclusive rights to the property where this rock can be found. However, beginning with the fourth year the firm's competition will have access to the material, and from that time on the firm will assume a normal growth...
Case study to discuss Eleanor has always loved working with patients at a large cancer center...
Case study to discuss Eleanor has always loved working with patients at a large cancer center in her city. Recently, however, you have noticed that the loss of one particular patient, Maria, has really been quite a blow for Eleanor. This is not the usual response Eleanor has to a patient’s death, and having worked at the center for 8 years, she has experienced her share of patient deaths. After Maria’s death, Eleanor wrote a brief post on her Facebook...
Case study to discuss Eleanor has always loved working with patients at a large cancer center...
Case study to discuss Eleanor has always loved working with patients at a large cancer center in her city. Recently, however, you have noticed that the loss of one particular patient, Maria, has really been quite a blow for Eleanor. This is not the usual response Eleanor has to a patient’s death, and having worked at the center for 8 years, she has experienced her share of patient deaths. After Maria’s death, Eleanor wrote a brief post on her Facebook...
A new element has recently been discovered but not yet named. Call it element X.
A new element has recently been discovered but not yet named. Call it element X.63        X33a.) What is the mass number of element X?b.) What is the atomic number of element X?c.) How many neutrons does element X have?d.) How many electrons does element X have?e.) How many protons does element X have?f.) How many electrons does element X have in the valence shell?g.) Is element X more electronegative or more electropositive?
A species of butterfly found in Central America (Macrosoma heliconiaria) recently has been discovered to have...
A species of butterfly found in Central America (Macrosoma heliconiaria) recently has been discovered to have ultrasound-detecting ears just in front of its forewings (a slightly different location than the ears found in Noctuid moths). Unlike other butterflies, this species is nocturnal. A) Using the correct terminology, briefly explain why this discovery of ears in an unrelated species is considered to be evidence that the ears in these butterflies and in Noctuid moths are anti-predator adaptations.   B) Design a simple...
John has recently discovered that online auctions can provide him with more opportunities to expand his...
John has recently discovered that online auctions can provide him with more opportunities to expand his business on the web. However, John has to conduct research about the various categories of auction Websites before choosing one that suits his business needs. Briefly explain three broad categories of auction Websites that should form part of John's research.
QUESTION 2 (15 marks) John has recently discovered that online auctions can provide him with more...
QUESTION 2 John has recently discovered that online auctions can provide him with more opportunities to expand his business on the Web. However, John has to conduct research about the various categories of auction Websites before choosing one that suits his business needs. Briefly explain the three broad categories of auction Websites, namely: 1. General consumer auctions 2. Specialty consumer auctions 3. Business-to-business auctions
You have always wanted to settle down on a different planet. NASA has recently announced that...
You have always wanted to settle down on a different planet. NASA has recently announced that it plans to construct and sell houses on the planet MARS. The current price of the house is $100,000 which is expected to increase every year at the inflation rate. You have just graduated from College and are currently 20 years old, you plan on working till the age of 40, save enough money and then move to MARS. You can earn 10% annually...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT