Stuck on problem from class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Stuck on problem from class

Question is write a statement that associates a new value from the first element of the list. The new value should be equal to twice the value of the last element on the list. The list name is play_list I have >>>play_list[0] = [-1] * 2 What am I missing?

18th Oct 2019, 12:57 PM
Brandon Carpenter
2 Answers
0
The " [-1] " you wrote is an anonymous array. You forgot the name of the array before it (you said, " play_list "), so play_list[0] will become an array with twice -1 inside.
18th Oct 2019, 1:13 PM
Gwlanbzh
Gwlanbzh - avatar
0
I'm having difficulty trying to understand the description. Can you give an example of the list content, and what output is expected? include input example if there is input needed. Add Python to Relevant Tags?
18th Oct 2019, 1:17 PM
Ipang