'''
Is Wed on 'days' list? True
The fourth item in 'days' is: Thu
['Mon', 'Tue', 'Wed', 'Thu','Fri', 'Sat', 'Sun', 'Sat']
['Tue', 'Wed', 'Thu', Fri', 'Sat', 'Sun', 'sat']
'''

'''
You need to create the following functions:
is_on_list
get_x
add_x
remove_x
'''


'''
DO NOT change anything inside of the "DO NOT TOUCH AREA"
해당 코드에서 빠진 함수가 있습니다. 위의 스크린과 같은 모습이 되도록 고쳐보세요.
반드시 위 표기된 함수들 (is_on_list. get_x. add_x. remove_x) 생성해야합니다.
DO NOT TOUCH 영역은 건들지마세요!
'''

퀴즈~~

"""
As you can see, the code is broken.
Create the missing functions, use default arguments.
Sometimes you have to use 'return' and sometimes you dont.
Start by creating the functions
"""

#^^^^^^^^^^^^^^^^^^^^^^^ Start ^^^^^^^^^^^^^^^^^^^^^^^^#
def is_on_list(inputlist, howdoUdo):
  if howdoUdo in inputlist:
    return True
  else:
    return False

def get_x(inputlist, howdoyoudo):
  return inputlist[howdoyoudo]

def add_x(inputlist, howUdo):
  return inputlist.append(howUdo)

def remove_x(inputlist, howyoudo):
  inputlist.remove(howyoudo)



# \/\/\/\/\/\/\  DO NOT TOUCH AREA  \/\/\/\/\/\/\ #

days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]

print("Is Wed on 'days' list?", is_on_list(days, "Wed"))

print("The fourth item in 'days' is:", get_x(days, 3))

add_x(days, "Sat")
print(days)

remove_x(days, "Mon")
print(days)


# /\/\/\/\/\/\/\ END DO NOT TOUCH AREA /\/\/\/\/\/\/\ #


 

이건 넘어가도록 하겟다~!

 

블로그 이미지

Or71nH

,