Posts by Camilla Marques • 107 points
5 posts
-
-1
votes1
answer131
viewsQ: How to use Regex to represent a more complex BNF?
I need to create a program with Regex that represents the following BNF’s: <list> ::= <element><list> | <element> <element> ::= <letter><digit>…
-
4
votes1
answer137
viewsQ: How to create a regex equivalent to a BNF?
I need to create a regular expression that is equivalent to the following BNF: <SEQ> ::= <DIG><SEQ> | <DIG> <DIG> ::= 0|1 I tried to create a Python code with the regex…
-
-1
votes1
answer24
viewsQ: How to display elements of specific sizes belonging to a list using lambda and filter functions?
In that code I wrote: lstNomes = ["casa", "google", "escola"] lstFiltro = list(filter(lambda x: x <= "5", lstNomes)) Is returning the empty array: [] I wanted to know how I get the element inside…
-
0
votes1
answer59
viewsQ: How to use round in lambda function
I want to understand how I can include the round in the following role: lstNumerosF = [10.01, 7.03, 2.23] lstMapa = list(map(lambda x: x ** 2, lstNumerosF)) print(lstMapa) I wanted to use inside the…
-
2
votes2
answers165
viewsQ: How can I get the highest value of a matrix with Lambda function in Python
In a list it is possible with the method "reduce" to achieve the highest value, but in a matrix I am not able to obtain the highest value of it: from functools import reduce matriz = [[4, 2, 56],…