Code War 41

[python]Find the Difference in Age between Oldest and Youngest Family Members

https://www.codewars.com/kata/5720a1cb65a504fdff0003e2/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com (가장 나이가 적은 수, 가장 나이가 많은 수, 둘의 차이)를 출력하는 문제이다. 더보기 내 코드 # My Code def difference_in_ages(ages): youngest_age = min(ages) oldest_age = max(ages) return..

[python]All Star Code Challenge#18

https://www.codewars.com/kata/5865918c6b569962950002a1/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 지정한 문자의 개수를 출력하는 문제이다. 더보기 내 코드 count를 이용하면 쉽게 풀 수 있는 문제이다. # My Code def str_count(strng, letter): return strng.count(letter) if __name__=='__..

[python]Will you make it?

https://www.codewars.com/kata/5861d28f124b35723e00005e/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문제 해석(구글 번역) 집에서 멀리 떨어진 친구들과 캠핑을 했지만 돌아갈 시간이 되면 연료가 떨어지고 가장 가까운 펌프가 50 마일 떨어져 있다는 것을 알게 됩니다! 평균적으로 자동차는 갤런 당 약 25 마일로 운행됩니다. 남은 갤런이 2 개 있습니다. 이러한 요소를..

[python]Removing Elements

https://www.codewars.com/kata/5769b3802ae6f8e4890009d2/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 인덱스 짝수 번호인 것 지우는 문제이다. 더보기 내 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 # My Code def remove_every_other(my_list): answer = [] for i in range(len(m..

[python]CamelCase Method

https://www.codewars.com/kata/587731fda577b3d1b0001196/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 각 단어들의 맨 알파벳을 대문자로 변경 후 스페이스 없애는 문제이다. 더보기 title()이라는 것을 사용하면 각 단어의 첫 글자를 대문자로 변경해준다. replace("old", "new")라는 것을 사용하면 old를 new로 바꾸어준다. 이 두 가지를 ..

[python]Bouncing Balls

https://www.codewars.com/kata/5544c7a5cb454edb3c000047/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 한 아이가 h 높이에서 공을 창문으로 던질 때 공은 h 곱하기 bounce만큼 튀어 오른다. 아이의 엄마가 window에서 볼 때 엄마는 공이 지나가는 것을 몇 번이나 보는지가 문제이다. 더보기 변수 h, bounce와 window가 각 조건을 만족하지 않으면 -1을..

[python]Highest Scoring Word

https://www.codewars.com/kata/57eb8fcdf670e99d9b000272/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 합이 가장 큰 단어 찾는 문제이다. 더보기 내 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 # My Code def high(x): answer_ = [] sum_ = 0 for i in x: if ..

[python]Build Tower

https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 별로 탑을 쌓아서 출력하는 문제이다. 문제를 풀기 위해 필요한 것 1. 스페이스와 *을 조합 수식 찾기 더보기 스페이스와 *의 조합 스페이스와 *이 눈으로 보기에 적합하지 않아서 스페이스를 X, *를 O로 바꾸어서 풀어보았다. 한 변의 X 수와 O의 수를 구해 보았다..

[python]Equal Sides Of An Array

https://www.codewars.com/kata/5679aa472b8f57fb8c000047/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 주어진 배열에서 한 개의 인덱스를 기준으로 왼쪽과 오른쪽의 합이 같은 인덱스를 찾는 문제이다. 문제를 풀기 위해 필요한 것 1. 합 구하기 2. 왼쪽과 오른쪽 비교 더보기 합 구하기 : sum(구하고 싶은 값들의 집합) 왼쪽과 오른쪽 비교 : if left == ri..

[python]Shortest Word

https://www.codewars.com/kata/57cebe1dc6fdc20c57000ac9/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 가장 짧은 단어의 길이를 구하는 문제이다. 문제를 풀기 위해 필요한 것 1. 문자열을 단어 별로 자르기 2. 단어의 길이 구하기 3. 단어들의 최솟값 찾기 더보기 문자열을 단어 별로 자르기 : 문자열.split() 단어의 길이 구하기 : len(문자열) 단..

728x90