python - Turning certain characters of lists into strings -


i'm working on second assignment school , new programming. covering lists in python , i'm having little trouble. we're making go fish game using lists, , need convert of characters list or new string. preferably string since need concatenate string.

we have list of lists representing cards each player, looking phands[0] = [ac,4c,2h,jd,ad], , need turn "a 4 2 j a"

def mycards (phands,player_number):      card_list = []     in range(len(phands[0])):         card_list = card_list + (phands[0][i][0])     return card_list 

it causing errors of not being able concatenate str list, , i'm not familiar join function. appreciated!! thank much!

use card_list.append(phands[0][i][0]).

+ works in context when elements on both sides lists. do:

card_list = card_list + [phands[0][i][0]] 

however, wasteful (1) allocates new temporary list object, , (2) returns new list object instead of modifying existing one.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -