join53 Descending Order Your task is to make a function that can take any non-negative integer as an argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number. Examples: Input: 42145 Output: 54421 Input: 145263 Output: 654321 Input: 123456789 Output: 987654321 Solution: def descending_order(num): return int("".join(sorted([i for i in str(num)], r.. 2022. 8. 5. Form The Minimum Task Given a list of digits, return the smallest number that could be formed from these digits, using the digits only once (ignore duplicates). Notes: Only positive integers will be passed to the function (> 0 ), no negatives or zeros. Input >> Output Examples minValue ({1, 3, 1}) ==> return (13) Explanation: (13) is the minimum number could be formed from {1, 3, 1} , Without duplications minVal.. 2022. 8. 2. Simple Fun #176: Reverse Letter Task Given a string str, reverse it and omit all non-alphabetic characters. Example For str = "krishan", the output should be "nahsirk". For str = "ultr53o?n", the output should be "nortlu". Input/Output [input] string str A string consists of lowercase latin letters, digits and symbols. [output] a string Solution: def reverse_letter(string): return ''.join([char for char in string[::-1] if char.. 2022. 7. 27. 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. SQL Basics: Simple JOIN with COUNT or this challenge you need to create a simple SELECT statement that will return all columns from the people table, and join to the toys table so that you can return the COUNT of the toys people table schema id name toys table schema id name people_id You should return all people fields as well as the toy count as "toy_count". Solution: SELECT p.id, p.name, COUNT(t.name) AS toy_count FROM people .. 2022. 7. 19. SQL Basics: Top 10 customers by total payments amount Overview For this kata we will be using the DVD Rental database. You are working for a company that wants to reward its top 10 customers with a free gift. You have been asked to generate a simple report that returns the top 10 customers by total amount spent ordered from highest to lowest. Total number of payments has also been requested. The query should output the following columns: customer_i.. 2022. 7. 14. 이전 1 2 3 4 5 6 7 8 9 다음