Posts by Marcos Vinícius • 124 points
9 posts
-
0
votes1
answer89
viewsQ: Smallest element of a sub-list, in a list
I’m trying to apply heuristics to a code that I’ve been working on, but I need to get the smallest element from a sub-list, from a list. example: L = [[1, 1, 6], [1, 2, 5], [1, 3, 7], [2, 1, 1], [2,…
-
0
votes2
answers7052
viewsA: How to count occurrences of a substring in a Python string?
frase = str(input("Digite a frase a se analisada: ")) palavra = str(input("Ocorrências da palavra/letra: ")) resultado = frase.count(palavra) print(f"Na frase |{frase}|, a palavra/letra |{palavra}|…
-
2
votes2
answers426
viewsA: Lists in PYTHON
You can try using the repeat loop for. For example. lista = [1, 2, 3, 4, 5] for item in lista: print(item) # item é o número contido na lista que vc quer usar. #Aqui vc coloca o resto do programa…
-
0
votes1
answer151
viewsA: What’s the matter? I use Pycharm
I don’t know if this will affect other parts but try to do so. is_int = True try: operacao = int(input('Digite a operação que você quer realizar:')) if 5 > operacao > 0: is_int = True else:…
pythonanswered Marcos Vinícius 124 -
1
votes1
answer75
viewsQ: Ghost repetition structure
maze = """\ ############## # # # # # ########## # # X# # ## #### # # # #### # # ############## """ EMPTY, BLOCK, STEP, END ,WALL=" ", "*", ".", "X", "#" UP, DOWN, LEFT, RIGHT = "˄", "˅", "<",…
pythonasked Marcos Vinícius 124 -
3
votes1
answer187
viewsQ: Library sys - maxsize
What is this function for sys.maxsize? import sys Menor: int = sys.maxsize What does this expression mean?
pythonasked Marcos Vinícius 124 -
0
votes1
answer679
viewsQ: Return the smallest value - Python
from collections import OrderedDict #Pra poder acessar os elementos igual listas e tuplas. v v v lista_aberta = {(1,3): [1,2,3,4], (1,4): [2,3,4,9], (1,5): [3,4,1,7]} I need to check all the…
-
0
votes1
answer535
viewsQ: Find a specific element in a list with sub-lists (Python)
I’m tweaking a Pathfindig code based on A*, I need to check and modify an element within a list with several sub-lists, but I have doubts if I use a repeat loop, or if there is already a function…
-
2
votes1
answer1977
viewsQ: Path to a python character
I adapted a program in Python that solves labyrinths, and I’m improving it, but I had problems with the minimum path (I even studied in Graphs), I was able to understand everything. But I’m having…