Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I have provided you with the shoes list from the last exercise

`In this exercise, I want you to make a function called addtofront, which will take in two parameters, a list and a value to add to the beginning of that list.

Once you have made your function, add this line of code to your exercise:

addtofront(shoes, "White Vans")`

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Code:-

shoes = ["Spizikes","Air Force 1","Curry 2","Melo 5"]
shoes.insert(0) = "White Vans"
def addtofront(shoes, "White Vans"):
    print(shoes)
addtofront()

Error:-

invalid syntax (exercise.py, line3

>Solution :

try this one:

shoes = ["Spizikes", "Air Force 1", "Curry 2", "Melo 5"]

def addtofront(shoe_list, front_shoe):
    shoe_list.insert(0, front_shoe)

addtofront(shoes, "White Vans")
print(shoes)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading