Functions
Go to https://www.wordsapi.com/ and copy the API response for any word of your choice.
word_lookup = <the dictionary you copied>
- Choose a word that is not too rare, so that it has various attributes and several meanings.
- For each function you create:
- store the result in some variable (if the function returns something)
- print the result with some label (so that not only you know what it means)
- provide some message in the function if the word_lookup does not have the attribute you are looking for.
In the examples, I will use the word shenanigan.
1. Write a function count_results that returns how many results there were for your word (the list word_lookup["results"])
Input: dictionary word_lookup
Returns: integer - the number of results
2. Write a function pronunciation that
Input: dictionary word_lookup
Returns: "pronunciation" for your word
3. Write a function word_definitions that iterates through all dictionaries in word_lookup["results"] and prints the definitions of the word.
Input: dictionary word_lookup
Returns: returns nothing, prints "definition" for this word, each on a new line
4. Write a function most_common_POS that iterates through all dictionaries in word_lookup["results"], stores all "partOfSpeech" in a list, and returns the partOfSpeech that occurs most frequently (use Counter)
Input: dictionary word_lookup
Returns: partOfSpeech that occurs most frequently
5. For any list (you can take a list of synonyms for your word) write a lambda function with map() to convert the list of lowercase strings to uppercase.
6. Write a function synonyms that iterates through all dictionaries in word_lookup["results"] (for loop), stores all synonyms from "synonyms" in one list (.append or .extend), and returns unique values from that list.
Input: dictionary word_lookup
Returns: unique synonyms
Example result:
{'deviltry', 'rascality', 'trickery', 'guile', 'mischievousness', 'mischief', 'devilment', 'roguishness', 'devilry', 'roguery', 'chicanery', 'wile', 'chicane', 'mischief-making'}
7. Write a function is_type_of that iterates through all dictionaries in word_lookup["results"] (for loop), and for each element in the list "typeOf" (another for loop inside) prints the line "<Word>" is a type of <typeOf>
Input: dictionary word_lookup
Returns: returns nothing, prints all typeOf records.
Example result:
"Shenanigan" is a type of deception.
"Shenanigan" is a type of deceit.
...
Note that "Shenanigan" is capitalized.
8. Write a function syllables that retrieves syllables from "syllables" and returns them as a single string separated by hyphens ('-'.join(...)).
Input: dictionary word_lookup
Returns: returns a string of syllables separated by hyphens.
Example result:
'she-nan-i-gan'
9. Function definition_and_more. Does the same as the function from task 3, but also takes Keyword Arguments additional_parameter, which takes the name of some additional attribute that should also be printed (default is None)
Input: dictionary word_lookup and (optionally) some additional parameter.
Returns: returns nothing, prints the definition and possibly something else.
Example function call:
definition_and_more(word_lookup, additional_parameter = "hasTypes")
Result (formatting is arbitrary, the main thing is that everything you called is included):
* reckless or malicious behavior that causes discomfort or annoyance in others
hasTypes: vandalism, hell, hooliganism, malicious mischief, monkey business, blaze
* the use of tricks to deceive someone (usually to extract money from them)
hasTypes: put-on, fraudulence, hoax, dupery, fraud, humbug, jugglery
10. A function that takes any number of attributes from those in "results" and outputs the values of those attributes.
(If there are no attributes, only word_lookup["word"] is output)
Example function call:
word_anything(word_lookup, 'hasTypes', 'partOfSpeech')
Result (formatting is arbitrary, the main thing is that word_lookup["word"] and the attributes you entered are included):
SHENANIGAN
----------
hasTypes : ['vandalism', 'hell', 'hooliganism', 'malicious mischief', 'monkey business', 'blaze']
partOfSpeech : noun
----------
hasTypes : ['put-on', 'fraudulence', 'hoax', 'dupery', 'fraud', 'humbug', 'jugglery']
partOfSpeech : noun
----------
Client's review of cooperation with Andrii Panichuk
FunctionsI am very satisfied with the collaboration! The freelancer completed the work efficiently and on time, was constantly in touch, and took all requests into account. I recommend for collaboration!
Freelancer's review of cooperation with Yevhen Inchevsky
FunctionsThank you for the project!
I am ready to work more!
-
94026 1265 1 10 Hello. I have extensive experience with Python. I am ready to complete the task.
-
139 4 1 Good day, I will gladly complete a similar task for you, feel free to write.
-
486 3 0 Good day, I am ready to take on this task for execution, I will be happy to collaborate.
-
3224 84 0 Ready to take it on.
Write to discuss the order details.
I will implement it in Python.
-
626 6 0 Good evening, I am ready to complete your order tonight and you will have a response in the morning.
-
3012 73 4 2 Good evening! I have experience = I can do it!!!!!!! Feel free to contact me!!!!
Current freelance projects in the category Databases & SQL
Need a Power BI specialist to build management reporting based on BAS Accounting CORPAbout the CompanyWe are a distributor of international sports brands in Ukraine. Accounting is maintained in BAS Accounting CORP.We are looking for a specialist who can help build a management reporting system for the company's management based on Power BI.Important: we are… Databases & SQL, Accounting Services ∙ 2 days 22 hours back ∙ 5 proposals |
Technical task: Integration of Telegram chatbot with BAS1. General Description It is necessary to implement the integration of the chatbot with the BAS system for the transfer and recording of data about products (orders). 2. Input Data (sent by the chatbot): Group ID Product name (with product code) Product price 3. Logic of… Enterprise Resource Planning (ERP), Databases & SQL ∙ 3 days back ∙ 19 proposals |
1C data integrationOrganize quality preparation and data transfer from 1C to BigQuery for further use in Looker:Organize the data according to the required fields.Prepare a clear structure of tables and intermediate datasets on which dashboards will be built.Set up data loading, gather key… Databases & SQL, Data Processing ∙ 4 days 16 hours back ∙ 9 proposals |
Development of a simple controlling and management record system in Google Sheets "turnkey"Task name: Development of a simple controlling and management record system in Google Sheets "turnkey" for a construction company in Poland (+ online training and implementation assistance) About the company, context, and my main problem Hello, I am looking for an experienced… Databases & SQL, Accounting Services ∙ 5 days 21 hours back ∙ 36 proposals |
Development of an analytical Power BI dashboard
45 USD
This is our request, we need a person who understands Power BI: Screen 1: Strategic Cockpit (Financial Health of the Plant) Goal: To understand in 5 seconds, "where are we losing money and how much?". KPI Tiles (Top Bar): Overall margin (Actual vs Plan) in %. Amount of "lost… Databases & SQL ∙ 6 days 1 hour back ∙ 13 proposals |