🐍 파이썬/파이썬 연습문제
-
[recursive] 연습하기 좋은 간단한 재귀함수 문제들🐍 파이썬/파이썬 연습문제 2022. 8. 16. 08:02
1. print 0 to 10 2. compute factorial/ power 3. reverse the string 4. find max / min value in the list def find_max(l): if len(l) == 0: return None if len(l) == 1: return l[0] max = find_max(l[1:]) if l[0] > max : return l[0] else: return max 5. print all values in nested list
-
-
-
-
-
-
[Dictionary] map key and value🐍 파이썬/파이썬 연습문제 2022. 7. 20. 09:11
문제: Implement a function that receives a list of Tuples, where every Tuple takes the form: (,,). The function should return two Dictionaries in a Tuple. The first dictionary should map from Actor to Movies, the second dictionary should map from Year to Movies. Example movie_maps( [("Keanu Reeves",Reeves","The Matrix", 1999 ),("Keanu Reeves", Bill Ted's Excellent Adventure", 1989)..
-
[list] find minimum in array🐍 파이썬/파이썬 연습문제 2022. 7. 20. 09:01
문제: Implement a function that receives a list of numbers as an argument and returns the index of the minimum value and the actual minimum value as a Tuple. Return None for an empty list Example find_min([3, 2, 5, 1, 7] should return (3, 1) def find_min(l): if l == []: return None min = l[0] min_i = 0 for i, num in enumerate(l): if num < min : min = num min_i = i retrun (min_i, min) print find_mi..