2021年3月17日星期三

Python pop. Trying to list pop (remove list ) into new variable (language)

I'm currently learning a python language. I face the problem on this question.

[ ] pop the last language from your list and store it in a variable called language.

Those empty box I need to tick to chech the answer.

This is the screenshot of my question

After I tick, I will get prompted with "language should contain the string 'JavaScript'"

Below is my code snippet.

courses = []  courses.append('Python')  courses.append('JavaScript')  print(courses)  removed_course = courses.pop()  print('Removed course:' + removed_course)    language = [removed_course]  language.append(removed_course)  print(language)  
https://stackoverflow.com/questions/66683915/python-pop-trying-to-list-pop-remove-list-into-new-variable-language March 18, 2021 at 10:26AM

没有评论:

发表评论