LOWER16 Alternate capitalization Given a string, capitalize the letters that occupy even indexes and odd indexes separately, and return as shown below. Index 0 will be considered even. For example, capitalize("abcdef") = ['AbCdEf', 'aBcDeF']. See test cases for more examples. The input will be a lowercase string with no spaces. Good luck! Solution: def capitalize(s): return [''.join(v.lower() if i%2==1 else v.upper() for i, v i.. 2022. 8. 23. Fix string case In this Kata, you will be given a string that may have mixed uppercase and lowercase letters and your task is to convert that string to either lowercase only or uppercase only based on: make as few changes as possible. if the string contains equal number of uppercase and lowercase letters, convert the string to lowercase. For example: solve("coDe") = "code". Lowercase characters > uppercase. Cha.. 2022. 8. 7. Highest Scoring Word Given a string of words, you need to find the highest scoring word. Each letter of a word scores points according to its position in the alphabet: a = 1, b = 2, c = 3 etc. You need to return the highest scoring word as a string. If two words score the same, return the word that appears earliest in the original string. All letters will be lowercase and all inputs will be valid. Solution: def high.. 2022. 7. 28. Replace With Alphabet Position Welcome. In this kata you are required to, given a string, replace every letter with its position in the alphabet. If anything in the text isn't a letter, ignore it and don't return it. "a" = 1, "b" = 2, etc. Example alphabet_position("The sunset sets at twelve o' clock.") Should return "20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11" ( as a string ) Solution: from typin.. 2022. 7. 22. Anagram Detection An anagram is the result of rearranging the letters of a word to produce a new word (see wikipedia). Note: anagrams are case insensitive Complete the function to return true if the two arguments given are anagrams of each other; return false otherwise. Examples "foefet" is an anagram of "toffee" "Buckethead" is an anagram of "DeathCubeK" Solution: def is_anagram(test, original): if len(test) < l.. 2022. 7. 21. Easy SQL: LowerCase Given a demographics table in the following format: ** demographics table schema ** id name birthday race you need to return the same table where all letters are lowercase in the race column. Solution: SELECT id, name, birthday, LOWER(race) as race FROM demographics; 2022. 5. 13. 이전 1 2 3 다음