Posts by t3m2 • 318 points
6 posts
-
0
votes2
answers129
viewsA: How to delete a json object with python?
If employees are stored on a list, you can try the following: data = ["João", "Pedro", "Maria"] print (data) funcionario_a_excluir = input('Quem quer excluir? ') print('Tem certeza?') print('1 -…
-
1
votes3
answers184
viewsA: Function to duplicate a Python list
Your code is almost adapted to your problem, only a few minor changes have been made to the line if elem not in uniqueList:. The entire initial list is traversed, and when a value is found with a…
-
0
votes2
answers947
viewsA: How to turn all items in a string list into integers?
Try this: lista_inicial = ["12", "-4", "-232", "7", "1478"] lista_final = [int(i) for i in lista_inicial] print(lista_final) Output: [12, -4, -232, 7, 1478]…
-
0
votes1
answer252
viewsA: See which elements of the list are primes
The function used to check whether a number is prime in this response is based on reply of Dawg in the Stack Overflow. This function is much more efficient because it is only necessary to check up…
-
13
votes2
answers174
viewsA: Filling a list using its size as a stop criterion
General response: Use: for i in range(numero_de_elementos_que_a_sua_lista_deve_ter): funcoes_opcionais_que_alteram_o_elemento_a_adicionar() a_sua_lista.append(elemento_a_adicionar) See the…
-
2
votes2
answers1840
viewsA: Online and shared programming
Repl.it gives you an Instant IDE to Learn, build, collaborate, and host all in one place. Repl.it is an online programming environment, has a Debugger and many other tools that help you program. It…