본문 바로가기

Python345

0104. Sleigh Authentication Christmas is coming and many people dreamed of having a ride with Santa's sleigh. But, of course, only Santa himself is allowed to use this wonderful transportation. And in order to make sure, that only he can board the sleigh, there's an authentication mechanism. Your task is to implement the authenticate() method of the sleigh, which takes the name of the person, who wants to board the sleigh .. 2023. 1. 4.
0103. Powers of 2 Complete the function that takes a non-negative integer n as input, and returns a list of all the powers of 2 with the exponent ranging from 0 to n ( inclusive ). Examples n = 0 ==> [1] # [2^0] n = 1 ==> [1, 2] # [2^0, 2^1] n = 2 ==> [1, 2, 4] # [2^0, 2^1, 2^2] Solution: def powers_of_two(n: str) -> list[int]: return [pow(2, i) for i in range(n+1)] 2023. 1. 3.
0102. Enumerable Magic #25 - Take the First N Elements Create a function that accepts a list/array and a number n, and returns a list/array of the first n elements from the list/array. Solution: def take(arr, n): result = [] arrs = [arr[i-1:i] for i in range(1, n+1)] for arr in arrs: result += arr return result 2023. 1. 3.
0101. Pillars There are pillars near the road. The distance between the pillars is the same and the width of the pillars is the same. Your function accepts three arguments: number of pillars (≥ 1); distance between pillars (10 - 30 meters); width of the pillar (10 - 50 centimeters). Calculate the distance between the first and the last pillar in centimeters (without the width of the first and last pillar). So.. 2023. 1. 1.
1231. For UFC Fans (Total Beginners): Conor McGregor vs George Saint Pierre This is a beginner friendly kata especially for UFC/MMA fans. It's a fight between the two legends: Conor McGregor vs George Saint Pierre in Madison Square Garden. Only one fighter will remain standing, and after the fight in an interview with Joe Rogan the winner will make his legendary statement. It's your job to return the right statement depending on the winner! If the winner is George Saint.. 2022. 12. 31.
1230. The Wide-Mouthed frog! The wide-mouth frog is particularly interested in the eating habits of other creatures. He just can't stop asking the creatures he encounters what they like to eat. But, then he meets the alligator who just LOVES to eat wide-mouthed frogs! When he meets the alligator, it then makes a tiny mouth. Your goal in this kata is to create complete the mouth_size method this method takes one argument ani.. 2022. 12. 30.