split21 Century From Year Introduction The first century spans from the year 1 up to and including the year 100, the second century - from the year 101 up to and including the year 200, etc. Task Given a year, return the century it is in. Examples 1705 --> 18 1900 --> 19 1601 --> 17 2000 --> 20 Solution: 1. Divide 'year' by 100. 2. Returns the decimal point rounded up. import math def century(year): return math.ceil(year.. 2022. 4. 13. Remove First and Last Character Part Two Description: This is a spin off of my first kata. You are given a string containing a sequence of character sequences separated by commas. Write a function which returns a new string containing the same character sequences except the first and the last ones but this time separated by spaces. If the input string is empty or the removal of the first and last items would cause the resulting string .. 2022. 4. 10. Reverse words Description: Complete the function that accepts a string parameter, and reverses each word in the string. All spaces in the string should be retained. Examples "This is an example!" ==> "sihT si na !elpmaxe" "double spaces" ==> "elbuod secaps" Solution: 1. Separate text based on space. 2. Turn over the separated text and put it in an array. 3. Convert the text in the array to a string with space.. 2022. 3. 28. Meeting Description: John has invited some friends. His list is: s = "Fred:Corwill;Wilfred:Corwill;Barney:Tornbull;Betty:Tornbull;Bjon:Tornbull;Raphael:Corwill;Alfred:Corwill"; Could you make a program that makes this string uppercase gives it sorted in alphabetical order by last name. When the last names are the same, sort them by first name. Last name and first name of a guest come in the result betwe.. 2022. 3. 17. Highest and Lowest Description: In this little assignment you are given a string of space separated numbers, and have to return the highest and lowest number. Examples highAndLow("1 2 3 4 5"); // return "5 1" highAndLow("1 2 -3 4 5"); // return "5 -3" highAndLow("1 9 3 4 -5"); // return "9 -5" Notes All numbers are valid Int32, no need to validate them. There will always be at least one number in the input string... 2022. 3. 8. Abbreviate a Two Word Name Description: Write a function to convert a name into initials. This kata strictly takes two words with one space in between them. The output should be two capital letters with a dot separating them. It should look like this: Sam Harris => S.H patrick feeney => P.F solution: 1. Change the name to all uppercase letters. 2. Separate strings based on space and put them in an array. 3. Put the first .. 2022. 3. 6. 이전 1 2 3 4 다음