[Solved] What i did wrong in my python function?

Well, you got what you told to print! board is a list of list of strs, so board[i] must be a list of strs, and when you write print(board[i]), you get a list! You may need to write this: print(”.join(board[i])) solved What i did wrong in my python function?

[Solved] Python- converting to float using map()

It’s ugly, but yeah, it can be done: my_list=[[‘Hello’, 1 , 3],[‘Hi’, 4 , 6]] print(list(map(lambda lst: list(map(lambda x: float(x) if type(x) == int else x, lst)), my_list))) # Output: [[‘Hello’, 1.0, 3.0], [‘Hi’, 4.0, 6.0]] EDIT I personally prefer list comprehension in most cases as opposed to map/lambda, especially here where all the conversions … Read more

[Solved] How can I make my program input images taken from a Camera? [closed]

You can capture a single frame by using the VideoCapture method of OpenCV. import cv2 pic = cv2.VideoCapture(0) # video capture source camera (Here webcam of laptop) ret,frame = pic.read() # return a single frame in variable `frame` while(True): cv2.imshow(‘img1’,frame) #display the captured image if cv2.waitKey(1) & 0xFF == ord(‘y’): #save on pressing ‘y’ cv2.imwrite(‘images/c1.png’,frame) … Read more

[Solved] How to loop back to the beginning of the code on Python 3.7

username = [‘admin’,’bill’,’Kevin’,’mike’,’nick’] while True : name =input(“Please enter a username: “) if name==’admin’ : print(“Hello “+ name + ” ,would you like to see a status report?”) break elif name in username : print(“Hello ” + name.title() + ” thank you for logging in!”) break else: print(“Who are you ” + name.title() + ” … Read more

[Solved] builtins.TypeError TypeError

You don’t need to pass category_name, you only need the category id. The category name should be contained in each of the item fetched from the database. You’re getting an error because cat_id is not defined when the function def getCategoryItems(category_name, cat_id) is called. I would suggest, however, if you want to really get all … Read more

[Solved] Check if n is in array [closed]

If I was developing this, I would: Keep all the words in a single set Skip the first question (you can determine word length by the length of the 2nd question) Set up a while loop for each question you ask the user so that it repeats the same question on invalid input. To check … Read more

[Solved] Highest number of consecutively repeating values in a list

I don`t really understand the question, but if you want the highest number of consecutive elements in list, maybe something like this from itertools import groupby list = [1,1,1,0,0,1,1,1,1,1] count_cons_val = [sum(1 for _ in group) for _, group in groupby(list)] print(max(count_cons_val)) Output: 5 solved Highest number of consecutively repeating values in a list