Implement a program that requests from the user a list of words (i.e., strings) and then prints on the screen, one per line, all four-letter strings in the list.
>>> Enter word list: ['stop', 'desktop', 'top', 'post']
stop
post
An acronym is a word formed by taking the first letters of the words in a phrase and then making a word from them. For example, RAM is an acronym for random access memory.
Write a function acronym() that takes a phrase (i.e., a string) as input and then returns the acronym for that phrase.
Note: The acronym should be all uppercase, even if the words in the phrase are not capitalized.
>>> acronym('Random access memory')
'RAM'
>>> acronym('central processing unit')
'CPU'
The class must support supports a two, one, or no input argument constructor.
Then define Bird as a subclass of Animal and change the behavior of method speak() in class Bird.
>>> snoopy = Animal('dog', 'bark')
>>> snoopy.speak()
I am a dog and I bark.
>>> tweety = Animal('canary')
>>> tweety.speak()
I am a canary and I make sounds.
>>> animal = Animal()
>>> animal.speak()
I am a animal and I make sounds.
>>> daffy = Bird()
>>> daffy.speak()
quack! quack! quack!
strnew =input("Enter word list:")
list = strnew.split (",")
for i in list:
if(len(i)==4):
print(i)
Expected output:
def acronym(phrase):
listwrds=phrase.split(' ');
stri="";
for i in listwrds:
stri+=(i.upper())[0];
return stri;
print(acronym('Random access memory'))
print(acronym('Central processing unit'))
Expected output:
class Animal:
def __init__(self,species="animal",language="make
sounds"):
self.__species=species;
self.__language=language;
def setSpecies(self,species):
self.__species=species;
def setLanguage(self,language):
self.__language=language;
def speak(self):
print('I am a '+self.__species+" and I "+self.__language);
class Bird(Animal):
def speak(self):
print("quack! quack! quack!");
snoopy = Animal('dog', 'bark');
snoopy.speak();
tweety = Animal('canary');
tweety.speak();
animal = Animal();
animal.speak();
daffy = Bird();
daffy.speak();
Expected output:
Implement a program that requests from the user a list of words (i.e., strings) and then...
Python Implement a program that requests from the user a list of words (i.e., strings) and then prints on the screen, one per line, all four-letter strings in the list. >>> Enter word list: ['stop', 'desktop', 'top', 'post'] stop post
I am currently facing a problem with my python program which i have pasted below where i have to design and implement python classes and record zoo database and takes user input as query. the error i am recieving says that in line 61 list index is out of range. kindly someone help me with it as soon as possible. Below is the program kindly check and correct it. Thanks! class Animal: def __init__(self, name, types, species, mass): self.name=name self.type=types...
I am currently facing a problem with my python program which i have pasted below where i have to design and implement python classes and record zoo database and takes user input as query. the error i am recieving says that in line 61 list index is out of range. kindly someone help me with it as soon as possible. Below is the program kindly check and correct it. Thanks! class Animal: def __init__(self, name, types, species, mass): self.name=name self.type=types...
Write a French/English dictionary lookup program. Read a list of pairs of English and French words from a file specified by the user. English/French words should be exact matches (don't try to find partial matches). Use the supplied EnglishFrenchDictionary.java class as your main class. Fill in the missing code in the DictionaryTable.java class to read the input file and perform the searches. Add code to the DictionaryTable read() method to: read pairs of lines (English word is on the first...
Hi there! I need to compare two essay into 1 essay, and make it interesting and choose couple topics which im going to talk about in my essay FIRST ESSAY “Teaching New Worlds/New Words” bell hooks Like desire, language disrupts, refuses to be contained within boundaries. It speaks itself against our will, in words and thoughts that intrude, even violate the most private spaces of mind and body. It was in my first year of college that I read Adrienne...