You are watching: Can only concatenate list (not "str") to list


I deserve to do: <1, 2, 3> + <4, 5, 6>But i cannot do:nums=<1, 2, 3>nums<1:>+nums<0>TypeError: can only concatenate perform (not "int") come listWhy?
Larz60+aetate et sapientia
*

see: http://c4m.cdf.toronto.edu/cohort1/winte...tions.htmlSpecifically In <4>:not with a slice, yet same thing.essentially nums<0> is thought about an int, no a listconcatenate must be perform + list, not list + intso the following works:n = <1,2,3,4,5>n1 = n<3:>+n<4:>print(n1)
(Jan-17-2017, 05:38 AM)Larz60+ Wrote: n = <1,2,3,4,5>n1 = n<3:>+n<4:>print(n1)Thanks. Ns tried the end a much better way:nums<1:>+>


See more: Dark Side Of The Moon Cake S, Pink Floyd Dark Side Of The Moon Cake

Possibly related Threads…
ThreadAuthorRepliesViewsLast Post
Why changing data in a replicated list transforms the initial list?plumberpy3372Aug-14-2021, 02:26 AMLast Post: plumberpy
Compile list of dictianories out of another list that dictianories by specific keysCatorCanulis10932Jun-10-2021, 08:35 PMLast Post: perfringo
Concatenate strJohnnyCoffee2805May-01-2021, 03:58 PMLast Post: JohnnyCoffee
Order a perform with succeeding permutations based on another listyvrob3759Mar-19-2021, 08:20 AMLast Post: supuflounder
Saving perform in a listquest_3906Mar-10-2021, 09:58 AMLast Post: quest_
*
Convert Bytearray right into List making use of list()Shlok2663Feb-18-2021, 10:44 AMLast Post: deanhystad
Adding List element if Second part of the List elements are the Samequest_3758Nov-25-2020, 04:33 PMLast Post: bowlofred
Count variety of occurrences of list items in perform of tuplest4keheart1724Nov-03-2020, 05:37 AMLast Post: deanhystad
*
Save list with nested list right into CSVSpongeB0B11,423Oct-12-2020, 07:26 AMLast Post: bowlofred
Appending to list of list in for loopnico_mnbl2679Sep-25-2020, 04:09 PMLast Post: nico_mnbl