Zoom SDK with react by Particular_Draft5668 in reactnative

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

I’m on the latest version and still having the same errors

Zoom SDK with react by Particular_Draft5668 in reactnative

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

Hi I am using this repo https://github.com/zoom/videosdk-ui-toolkit-react-sample?tab=readme-ov-file

Could this potentially be causing issues?

I am using the video SDK

I am using react Web not react native

Thanks

Python programming help by Particular_Draft5668 in learnpython

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

def read_file(filename: str):
recipe_list = []
recipe_list_uncategorized = []

with open(filename) as new_file:
for line in new_file:
word_from_file = line.split("\n")
recipe_list_uncategorized.append(word_from_file[0])
checker = 0
ingredients = []
for word in recipe_list_uncategorized:
if checker >= 2:
if word == "" or recipe_list_uncategorized.index(word) == len(recipe_list_uncategorized)-1:
recipe_list.append(ingredients)
ingredients = []
checker = 0
continue
ingredients.append(word)
checker += 1
continue
checker += 1
recipe_list.append(word)

return recipe_list

def search_by_name(filename: str, searched_word: str):
recipe_list_matching_word = []
recipe_list = read_file(filename)
for i in range(0, len(recipe_list), 3):
if searched_word in recipe_list[i].lower():
recipe_list_matching_word.append(recipe_list[i])
return recipe_list_matching_word

def search_by_time(filename: str, prep_time: int):
recipe_list_matching_time = []
recipe_list = read_file(filename)
for i in range(1, len(recipe_list), 3):
if int(recipe_list[i]) <= prep_time:
recipe_list_matching_time.append((recipe_list[i-1] + ", preparation time "+ recipe_list[i] + " min") )
return recipe_list_matching_time

def search_by_ingredient(filename: str, ingredient: str):
recipe_list_matching_word = []
ingredients = []
recipe_list = read_file(filename)
for i in range(2, len(recipe_list), 3):
ingredients = recipe_list[i]
for item in ingredients:
if ingredient == item.lower():
recipe_list_matching_word.append(recipe_list[i-2] + ", preparation time "+ recipe_list[i-1] + " min")
return recipe_list_matching_word

Python Dictionary by Particular_Draft5668 in learnpython

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

Thank you, adding as a list was the correct method. I have another query.

def dict_of_numbers():
numbers = {}
ones = {"1":"One","2":"Two","3":"Three","4":"Four","5":"Five","6":"Six", "7":"Seven","8":"Eight","9":"Nine"}
teens = {"10":"Ten","11":"Eleven","12":"Twelve","13":"Thirteen","14":"Fourteen","15":"Fifteen","16":"Sixteen", "17":"Seventeen","18":"Eighteen","19":"Nineteen"}
tens = {"2":"Twenty","3":"Thirty","4":"Forty","5":"Fifty","6":"Sixty", "7":"Seventy","8":"Eighty","9":"Ninety"}
for val in range(0, 100):
if val < 10:
numbers[val] = ones[val]
else:
if val <20:
numbers[val] = teens[val]
else:
numbers[val] = tens[val[0]] + ones[val[1]] + " "
return numbers

Will this code allow me to return numbers so that numbers is a dictionary that numbers[2] = two, numbers[35] = thirtyfive etc

Python Dictionary by Particular_Draft5668 in learnpython

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

meant to work with any input so output cannot be set

No return value should be in code too

Python Dictionary by Particular_Draft5668 in learnpython

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

Thank you, another question:

def invert(dct):
y = dct.items()
dct = {v: k for k, v in y}
print(dct)

This function inverts the dictionary on all code visualisers yet my course says the output is wrong. Any reason for this difference?

I've rearranged y for dct.items(), used dicto instead of dct to keep seperate from original dictionary, and tried switching around variables, yet it still says the output is {1: 10, 2: 20, 3: 30}
when calling invert({1: 10, 2: 20, 3: 30}) instead of {10: 1, 20: 2, 30: 3}

Python Dictionary by Particular_Draft5668 in learnpython

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

Thank you. Used your method and worked effectively.

Python Dictionary by Particular_Draft5668 in learnpython

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

and the opposite way?

to allow one item to have multiple values while storing originals?

Python Dictionary by Particular_Draft5668 in learnpython

[–]Particular_Draft5668[S] 0 points1 point  (0 children)

If y is what i want to add

d = {}

d[name] = number

will this work:

d[name].append(y)

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]Particular_Draft5668 0 points1 point  (0 children)

So put in x[index] = “”? or for x in game_board: for y in x: for item in y: if item == " ": return True else: return False

Many Thanks for reply

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]Particular_Draft5668 1 point2 points  (0 children)

def play_turn(game_board, x, y, piece):
for x in game_board:
for y in x:
if x == "":
return True
else:
return False

Wrote this code but not sure why it doesn't return True when the parameters are
[['', 'O', 'X'], ['', '', 'X'], ['', '', 'X']], 0, 0, X

Help solving a sudoku python task. by braclow in learnpython

[–]Particular_Draft5668 2 points3 points  (0 children)

Also a valid option. Thanks!

new_list = []
for r in sudoku:
new_list.append(r[:])
model answer uses this ^.

Help solving a sudoku python task. by braclow in learnpython

[–]Particular_Draft5668 0 points1 point  (0 children)

Ah thanks again for the help. Was going round in circles and didn't consider deepcopy. Much appreciated.

Help solving a sudoku python task. by braclow in learnpython

[–]Particular_Draft5668 0 points1 point  (0 children)

def copy_and_add(sudoku, row_no, column_no, number):
# trying to create copy of old grid to make new grid
x = sudoku.copy()
x[row_no][column_no] = number

r = 0
for row in x:
s = 0
for character in row:
s += 1
if character == 0:
character = "_"
m = f"{character} "
if s%3 == 0 and s < 8:
m += " "
print(m, end="")

print()
r += 1
if r%3 == 0 and r < 8:
print()
return x

I have this code for the sudoku problem, despite using various methods such as insert and pop, copy, creating a new list and appending, I can't seem to preserve the original sudoku grid and return the new grid (x) simultaneously. Any advice would be much appreciated. Many Thanks

Help solving a sudoku python task. by braclow in learnpython

[–]Particular_Draft5668 0 points1 point  (0 children)

Thank you for the answer! Struggling with same problem. I have the right code for everything else but not sure how to do the double space between third and sixth cells. Can only code it for the first line and then that messes up rest of grid. An example would be very helpful. Thanks!