Please provide complete answer with screenshots as well
Posted: Fri May 20, 2022 11:11 am
Please provide complete answer with screenshots as well
1. A group of items are said to be ordered in a descending order if it is empty or each item except the last one is greater than its predecessor. Develop a function descend() which takes a string of words as an input, and prints True if words are in a descending order, and False otherwise. Your answer must be hard coded (refrain from using Python's built-in functions). Save your file as descend.py. Note: a sentence of one or no words is considered ordered. For example, >>> descend("You were the smartest person in Australia") True >>> descend("Python is a procedural language. Have fun!") False >>> descend (" ") True >>> descend ("Melbourne") True Start your answer by stating the algorithm, i.e. steps required to solve the problem. Also make sure to add comments to your code that correspond to the algorithm.
2. You are a linguistics professor and you were asked to invent a new human language. The new language takes English words as an input a produces new words based on the following rules: First step: Each letter is replaced by a letter three places to its right. For example, Melbourne' becomes 'Hoerxuqhp". In this example, the letter 'M' is replaced by 'P', which is three places to its right. The same applies to the rest of the letters. Second step: The first letter in the new word is moved to the end and turned into a small letter. The first letter in the resulting word is capitalised. Third step: The letters ".xy' are added to the final word. Write a function linguistics (), which takes an English word as an input and converts it into a new word according to the above rules. Save your file as linguistics.py. For example, a >>> linguistics ("Melbourne") Hoerxughp.xy >>> linguistics ("Australia") Xvwudoldd.xy
1. A group of items are said to be ordered in a descending order if it is empty or each item except the last one is greater than its predecessor. Develop a function descend() which takes a string of words as an input, and prints True if words are in a descending order, and False otherwise. Your answer must be hard coded (refrain from using Python's built-in functions). Save your file as descend.py. Note: a sentence of one or no words is considered ordered. For example, >>> descend("You were the smartest person in Australia") True >>> descend("Python is a procedural language. Have fun!") False >>> descend (" ") True >>> descend ("Melbourne") True Start your answer by stating the algorithm, i.e. steps required to solve the problem. Also make sure to add comments to your code that correspond to the algorithm.
2. You are a linguistics professor and you were asked to invent a new human language. The new language takes English words as an input a produces new words based on the following rules: First step: Each letter is replaced by a letter three places to its right. For example, Melbourne' becomes 'Hoerxuqhp". In this example, the letter 'M' is replaced by 'P', which is three places to its right. The same applies to the rest of the letters. Second step: The first letter in the new word is moved to the end and turned into a small letter. The first letter in the resulting word is capitalised. Third step: The letters ".xy' are added to the final word. Write a function linguistics (), which takes an English word as an input and converts it into a new word according to the above rules. Save your file as linguistics.py. For example, a >>> linguistics ("Melbourne") Hoerxughp.xy >>> linguistics ("Australia") Xvwudoldd.xy