분류 전체보기347 [Check-IO] The Most Wanted Letter [1] Problem: https://py.checkio.org/en/mission/most-wanted-letter/ [2] My solutions def checkio(text: str) -> str: #replace this for solution text = text.lower() word_list = list(dict.fromkeys(text)) word_dict = {} for word in word_list: if word.isalpha(): word_dict[word] = text.count(word) return sorted(word_dict.items(), key=(lambda x: (-x[1], x[0])))[0][0] if __name__ == '__main__': print("Ex.. 2021. 12. 19. [Check-IO] Follow Instructions [1] Problems: https://py.checkio.org/en/mission/follow-instructions/ [2] My solutions def follow(instructions: str) -> Tuple[int, int]: # your code here f = instructions.count('f') b = instructions.count('b') l = instructions.count('l') r = instructions.count('r') return (- l + r, -b +f ) [3] Good solutions def follow(instructions): c = instructions.count return c('r') - c('l'), c('f') - c('b') 2021. 12. 18. [Check-IO] Common Words [1] Problem: https://py.checkio.org/en/mission/common-words/ [2] My solution def checkio(line1: str, line2: str) -> str: # your code here line1 = line1.split(',') line2 = line2.split(',') result = [] for word in line1: if word in line2: result.append(word) return ",".join(sorted(result)) [3] Best solutions 2021. 12. 16. [GitHub] remote: Support for password authentication was removed on August 13, 2021 remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. fatal: Authentication failed for 2021년 8월 13일부터 Github 측에서는 패스워드로 인증하는 것 대신에 personal access token을 이용하도록 변경을 했다. 이러한 변경 이유에는 패스워드로 인증하는 것이 해킹당할 수 있는 보안.. 2021. 12. 12. [Check-IO] Sum by Type [1] Problem: https://py.checkio.org/en/mission/sum-by-type/ [2] My solution: def sum_by_types(items: list) -> Tuple[str, int]: # your code here first_arg = '' second_arg = 0 for var in items: if isinstance(var, str): first_arg = first_arg + var else: second_arg = second_arg + var return (first_arg, second_arg) [3] Best solution def sum_by_types(items): result = ['', 0] for item in items: result[.. 2021. 12. 12. [Check-IO] Time converter 1. Problem: https://py.checkio.org/en/mission/time-converter-24h-to-12h/ 2. My solutions def time_converter(time): #replace this for solution hour, minutes = time.split(":") hour = int(hour) if hour > 12 or hour == 12: if hour > 12: hour = hour - 12 day_night = 'p.m.' else: if hour == 0: hour = 12 day_night = 'a.m.' time_string = "%d:%s %s" %(hour, minutes, day_night) return time_string if __nam.. 2021. 12. 10. [NW] 셔틀버스 정보 1. Evanston Loop: https://www.northwestern.edu/transportation-parking/shuttles/routes/evanston-loop.html Intercampus https://www.northwestern.edu/transportation-parking/shuttles/routes/intercampus.html Intercampus: Transportation & Parking - Northwestern University Intercampus Per CDC requirement community members are required to wear masks on all University-provided group/mass transit. The Inte.. 2021. 12. 8. [CheckIO] Goes Right After [1] Problem: https://py.checkio.org/en/mission/goes-after/ [2] My solution def goes_after(word: str, first: str, second: str) -> bool: # your code here word_list = list(word) if (first not in word_list) or (second not in word_list): return False if first == second: return False first_index = word_list.index(first) word_list.pop(first_index) second_index = word_list.index(second) if first_index =.. 2021. 12. 3. [Check-IO] Absolute Sorting [1] Problem: https://py.checkio.org/en/mission/absolute-sorting/ [2] Solution def checkio(values: list) -> list: # your code here abs_sorted = sorted([abs(n) for n in values]) answers = [] for n in range(len(abs_sorted)): if not abs_sorted[n] in values: answers.append(- abs_sorted[n]) else: answers.append(abs_sorted[n]) return answers if __name__ == '__main__': print("Example:") print(checkio([-.. 2021. 11. 14. 이전 1 ··· 14 15 16 17 18 19 20 ··· 39 다음