9.4k views
3 votes
The function below takes a two parameters: a list called a_list and a value called a_value. Complete the function to first check to see if the value is already in the list. If the value is already in the list, then do nothing. Otherwise, append the value to the end of the list. Your function doesn't need to return anything.

1 Answer

4 votes

Step-by-step explanation:

def checklist(a_list, a_value):// def //used to name a function, the //arguments being passed into the //functions are a_list and a_value

if a_value in list://if statement to

//check if it's in the list or not

print("")//print statement to do

//nothing

else://else statement for if the

//a_value is in a_list

a_list.append(a_value)//this adds

//the value to the list

User Satyaki Sanyal
by
5.9k points