[부스트코스] 코칭스터디 9기 : AI Basic 2023 1주차 미션(Q1, Q2) 변형 문제 풀이
Q1. num_list 가 홀수인 데이터만 출력하도록 하는 함수를 작성하시오. Input #주어진 리스트 num_list = [3, 9, 11, 14, 18, 21, 25, 27] def get_odd_num(num_list): for num in num_list[:]: if (num %2 == 0): num_list.remove(num) return num_list print(get_odd_num(num_list)) Output [3, 9, 11, 21, 25, 27] Q2. string 문장을 받아 단어를 역순으로 출력하는 함수를 작성하시오. Input sentence = "Life is too short You need python" def reverse_sentence(sentence): resu..
2023. 1. 13.