Questions tagged [parentheses]
The symbols "(" and ")", commonly used in programming languages. Please use this tag only if the specific usage of these symbols is a relevant part of the question.
1,032
questions
1
vote
1
answer
73
views
Convert prefix to infix with minimum number of parentheses
Right now this is my code:
precedence = {
"+": 1,
"-": 1,
"*": 2,
"/": 2,
"": 0
}
def is_operator(token):
ope = set(['+', '-',...
0
votes
0
answers
26
views
Groovy code fail when debugging in IntelliJ IDEA
When I'm trying to run my Groovy code in IntelliJ IDEA it fails on using .size without parenthesis:
response.errors.size == 0
although there is no error in the response ('errors' array is empty).
...
0
votes
1
answer
63
views
Why is '(x in list_1) == True' is True but 'x in list_1 == True' is False? [duplicate]
I know this is can be a very basic question, but I found something curious on Python. I will try to explain this with the following example:
l = [1,2,3,4,5]
n1 = 1
We know the following:
print( n1 in ...
0
votes
1
answer
28
views
Error when not using named parameters when calling a function reference
I get the following error:
The argument type 'void Function(String?)' can't be assigned to the parameter type 'void Function()?'
when I this in my code:
void openNoteBox(String? docID) {}
...
***...
0
votes
2
answers
56
views
using sep argumnt to put double rounded parenthesis
I would like to close in double parenthesis the second column I am trying to unite
library(tidyr)
mtcars %>%
summarise(mean = mean(mpg),
sd = sd(mpg)) %>%
tidyr::unite('A', 1:...
0
votes
1
answer
28
views
Is there any difference between using "content = { }" parameter or directly "{}" in Jetpack Compose?
I was wondering if it is better to use directly "content = {}" parameter instead of "{}" despite I see more often people using "{}".
Is the code cleaner or does the code ...
-1
votes
2
answers
66
views
I have an error in BigQuery Sql while following teacher's post to make a temp table, it doesn't like the parentheses and I don't know why?
WITH trips_over_1_hr AS
(
SELECT *
FROM
`bigquery-public-data.new_york_citibike.citibike_trips`
WHERE
tripduration >= 60
)
I typed this as the teacher demonstrated ...
0
votes
3
answers
89
views
Trying to figure out how to handle math expression including parentheses
so I'm currently trying to write a code that basically knows how to deal with mathematical expressions, it has some other little features such as calculating average, getting min number out of 2, ...
-1
votes
2
answers
119
views
Match functions with more than two arguments with Regex
I want to write a regular expression in Python that matches functions with more than two arguments, such that the following expressions match:
function(1, 2, 3)
function(1, 2, 3, 4)
function(1, ...
1
vote
2
answers
68
views
Regex - Matching an optional group of text within parentheses including parenthese themselves - while grouping
Am unable to modify my code to enable it to detect and include an optional block of text within parentheses
Am trying to extract text and am successful with my first version of code which is working ...
0
votes
0
answers
45
views
Case when RLIKE
I'm trying to write case when which checks if specific column values are containing certain logic.
CASE
WHEN 111 AND ((LENGTH(222) != 10) OR
(LENGTH(222) = 10 AND NOT ((
...
0
votes
1
answer
45
views
Batch function errror when i feed it a varible with current value including parenthesis
I'm trying to write a .bat file that changes the location and name of some files I need to work with,(I will move them to the same folder the batch file is in) for the first one it works fine, but ...
1
vote
1
answer
62
views
Bug with Parenthesis in QFileDialog
Here some code where opens default windows dialog and user can select file which name starts with prefixName and ends with ".log"
void doSomething(QString prefixName) {
auto result = ...
-1
votes
1
answer
54
views
Remove parenthesis from itertools.combinations list
I want to make a list of all possible combinations in a range of numbers, and print them line by line without surrounding parentheses. Here is the code I've built so far.
import itertools
x = range(...
0
votes
1
answer
168
views
ESlint / Prettier : how do I disable a certain function parentheses parameter?
I have a Nuxt3 code
I have set ESlint and Prettier, and they began forcing parentheses in arrow function bodies. NOT the arguments, NOT the operators, but function bodies.
Example :
<VInputText
...
-1
votes
1
answer
71
views
powershell missing closing ')' because of bracket in username
How can i possibly fix this?
Kind Regards.
-6
votes
1
answer
101
views
How to create an algorithm that takes as input a propositional logic expression without parentheses and encloses the same in parentheses in Python
I'd like to create an algorithm that takes as input a propositional logic expression without parentheses and outputs the same expression enclosed in parentheses in all possible ways depending on the ...
0
votes
3
answers
35
views
Remove Parentheses from span with class using JS
While using a audio plugin for wordpress, the span/class automatically adds parentheses around the text, for example:
`<span class="songwriter">(Female & Male dialog, Humorous, ...
1
vote
1
answer
242
views
Use on parenthesis () or use curly brackets {} in react component
I'm testing a react component, but have problems using an array map where is define an anonymous arrow function, and after arrow (=>) I use curly brackets. Then the inside code could not be ...
0
votes
0
answers
61
views
Expected Procedure Error from Function that Should Expect Boolean
So I am trying to write a function that iterates through a list of points and counts the number of points that are less than a certain distance from a given plane. My issue is that I am getting the &...
1
vote
0
answers
11
views
operator vs () parenthesis in JAVA
int a=5;
a+=5+(++a)+(a++);
Now the output should be 24 because first the parenthesis will be executed and if this is so then it will be a=a+5+(++a)+(a++)=>a= 7 + 5 + 6 + 6 but the output ...
1
vote
4
answers
79
views
Hello this is a simple program in C++. It calculates the temperature from Fahrenheit, Parenthesis Math Result Error [duplicate]
When I wrap 5/9 in parenthesis, the result is 0, but when I don't put in the parenthesis, the result is correct. Why is this?
#include <iostream>
int main()
{
double temperature_farenheit =...
-2
votes
1
answer
106
views
Parenthesis Checker
Given an expression string x. Examine whether the pairs and the orders of {,},(,),[,] are correct in exp.
For example, the function should return 'true' for exp = [()]{}{[()()]()} and 'false' for exp =...
0
votes
3
answers
175
views
create a regex that knows balanced parenthesis with maximum depth of 5
I have a problem with a regex, it is supposed to match if the depth is between 1 or 5, for example it should match with “()()()”, “((((()))))”, “(()((()))())” and not match with “())()”, “(((((())))))...
3
votes
1
answer
163
views
Should I use parentheses in declarative macros?
Should I add parentheses to macro rules, as in my below macro I added parentheses around $addr for the case if $addr's top-level operation is a low precedence operator (lower than +)?
/// `read_field!(...
-1
votes
5
answers
114
views
Map parenthetical substrings from one array to another array and use a fallback string when no parenthetical substring
After modifying a query result, I end up with an array like the following example:
[0] => foo (bar1)
[1] => bar (foo2)
[2] => bas
[3] => foo (bas3)
[4] => bar
As you can see, some of ...
0
votes
1
answer
32
views
VBA Excel clear contents after parentheses of a formula
For a small procedure within a larger VBA Excel script I have the below code:
Worksheets(1).Columns("J:K").Select
For Each cell In Selection
If cell.Interior.Color = vbYellow Then
cell....
1
vote
0
answers
131
views
Rounded square brackets
dear experts!
I am trying to encode rounded square brackets in LaTeX. "[ ]" are not suitable because not rounded, look clumsy, and can be misinterpreted. Round regular brackets "( )&...
1
vote
1
answer
22
views
Iterate over pandas dataframe column, search for parentheses and delete them (and everything inside of it)
I have want to achieve the following. I have a pandas dataframe containing the column "email". I want to iterate over the rows in this column and search in each cell for the parentheses. ...
-1
votes
1
answer
79
views
Checking Duplicate Parenthesis Using stacks in java
The code is to check weather Duplicate parenthesis exist or not ..
I am getting true for every string. I am unable to find where I am wrong
public class DuplicatePar {
public static void main(...
0
votes
0
answers
26
views
Wrong output using python strip() function [duplicate]
So I am having a weird issue here
When I am stripping a certain string which have parenthesis, its removing the first word after the parenthesis
Ex:
c = 'PurchaseOrderItem(d330d1adf0)'
print (c.strip(&...
-3
votes
1
answer
57
views
Order of parenthesis in case of multiplication and division [closed]
Consider the following statement in C
j=2 * 3 / 4 + 2.0 / 5 + 8 / 5;
If the parenthesis is done considering BODMAS rule:
j=(2 * (3 / 4)) + (2.0 / 5) + (8 / 5); // then j = 0
If we take the priority ...
1
vote
2
answers
68
views
Trying to remove all text within Parentheses and remove parentheses as well as well as Turn all the capital letters except Except the first letter
I have a google sheet with a list of names that I am trying to apply my existing formula to. There are some names that have parentheses with text within those parentheses as well as some names that ...
0
votes
2
answers
256
views
Remove ")" from cells in list if ")" exists
Could you please tell me how can I remove ")" from strings in a list without converting the list to a string? Example:
Input:
list =[
'ABDDDDC 1,000 IWJBCKNBCDVV',
'BDISJBJ 2,000 ...
0
votes
1
answer
83
views
I am trying to write an algorithm that uses a stack to check if an expression has balanced parentheses but I keep encountering this error
def is_matched(expression):
left_bracket = "[({"
right_bracket = "])}"
my_stack = Stack(len(expression))
# our solution methodology is to go through the expression ...
0
votes
0
answers
34
views
Code for parenthesis matching using stack made with double linked list isn't giving any output
I was given an assignment to write the code for parenthesis matching using Double Linked Lists. So, I made stack functions using the same and even wrote the parenthesis matching function with it. But ...
0
votes
1
answer
194
views
Using parenthesis in Batch
The following code:
SET I=1
IF %I%==1 (
SET /A X = (3 + 1) %% 3
)
gives error: % was unexpected at this time.
We can understand the error from the following:
SET I=1
IF %I%...
0
votes
2
answers
66
views
I was creating my own palindrome program when I came across that if I use [ ] for 'if' loop, every time it printed the 'if' statement
The use of parentheses for 'if' loop results in two different output for a palindrome program!
1.) () this gives the accurate result
2.) [] this only gives you the result of 'if' statement even if the ...
3
votes
3
answers
79
views
Python calling instance function without making an instance [duplicate]
class add:
def add_me(self, *args):
res = 0
for x in args:
res += x
return res
print(add().add_me(1, 2, 3, 4, 5)) # 15
print(add.add_me(add(), 1, 2,...
0
votes
1
answer
227
views
function that checks for balanced parenthesis in python
Write a function is_balanced(chars) that takes a string and determines
if the various bracketing characters (e.g. ( ), [ ], and { } ) are
balanced returning True when balanced and False when not. In a
...
2
votes
2
answers
163
views
Ruby: split string on parentheses and space
I want to use RegEx to split a string with space and parentheses
Example:
"The (New York city) :) is big"
=> Output:
["The", "New York city", ":)", "...
0
votes
1
answer
160
views
Parentheses inside command substitution expression
I need to get array of filenames that have .jpg or .png extensions in my bash script. For that purpose I write this command:
imagesArray=( $(ls (*.png|*.jpg)) )
which supposed to execute ls command ...
2
votes
1
answer
373
views
Regular expression to match balanced parentheses or none parantheses
I need a regular expression to test string , either string do not contain parentheses or it contain balanced parentheses. The expression I am using only check it contain balanced parentheses or not . ...
1
vote
1
answer
47
views
Java - How to validate regex expression with multiple parentheses then extract the components from the string?
I have an input string like:
abc(123:456),def(135.666:3434.777),ghi("2015-06-07T09:01:05":"2015-07-08")
Basically, it is (naive idea with regex):
[a-zA-Z0-9]+(((number)|(quoted ...
1
vote
1
answer
246
views
Having trouble understanding if x % 4 == 0 and ( x % 100 == 0 and x % 400) == 0
leap_year = int(input('Year: '))
initial_year = leap_year
while True:
leap_year += 1
if leap_year % 4 == 0 and (leap_year % 100 == 0 and leap_year % 400) == 0:
print(f'The next leap ...
-1
votes
1
answer
67
views
How can we generate all possible parenthesizations of a tuple of integers?
The following is one example of what our input looks like...
# INPUT
(1, 2, 3)
The input is an iterable container full of integers.
The desired output is a tuple of all ways to parenthesize the ...
0
votes
1
answer
32
views
Balancing Parenthesis for Lab Project
import stack.RStack;
public class Expressions {
private RStack data;
public Expressions() {
}
public boolean checkbalance(String expression) {
char charAt;
int i, ...
3
votes
1
answer
1k
views
In (Neo)Vim, how can I highlight the nearest pair of brackets which my cursor is inside of?
To be clear, I don't want to highlight matching brackets when I hover over a bracket.
Let's say I have the following code:
function foo(bar) {
Say my cursor is hovering over the a in bar. I want (Neo)...
1
vote
1
answer
186
views
Generate all valid parenthesis with three types of parentheses
I encountered the problem of generating all combinations of valid parenthesis in a given length, when there is only one type of parenthesis - ( and ).
The solution I wrote is:
def generate(n, open, ...
0
votes
0
answers
14
views
what these parenthesis in this require works? [duplicate]
I have this code with the require function of NodeJS and I don't know how it works and what it exactly returns to the "sass" variable. What we archieve with the second require between ...