[Solved] Unable to trim string in PowerShell

try -replace to delete substrings by regex patterns PS> $string1=”abc_xyz-mnq_R81″ PS> $string2=”abc_xyz-mnq_R82″ PS> $string1 -replace “^.*_R” 81 PS> $string2 -replace “^.*_R” 82 0 solved Unable to trim string in PowerShell

[Solved] How can I implement loop in this program?

Here is how you can use a loop to get input, and append the burger prices to a list: burgerPrices = [] for n in range(3): burgerPrice = int(input()) burgerPrices.append(burgerPrice) cokePrice = int(input()) spritePrice = int(input()) current = [burgerPrice+cokePrice for burgerPrice in burgerPrices]+\ [burgerPrice+spritePrice for burgerPrice in burgerPrices] print(min(current) – 50) Or even better, a … Read more

[Solved] Passing Object of SuperClass to the SubClass Constructor in Python

class super(object): def __init__(self, **kwargs): self.abc = kwargs.pop(‘abc’, None) self.xyz = kwargs.pop(‘xyz’, None) class sub(super): def __init__(self, *args, **kwargs): super().__init__(**kwargs) self.pqr = kwargs.pop(‘pqr’, None) self.sty = kwargs.pop(‘sty’, None) self.contain = args[0] obj_super = super(abc=1, xyz = 2) obj_sub = sub(obj_super, pqr =3, sty=4) print(obj_sub.contain.abc) solved Passing Object of SuperClass to the SubClass Constructor in Python

[Solved] write the folder path for it [closed]

@Monso, as per your provided inputs, expected outputs in problem & in comments, I’ve written the code to solve your problem. In my case: Input directory: C:\Users\pc-user\Desktop\Input Output directory: C:\Users\pc-user\Desktop\Output And I have 3 file A.txt, B.txt & C.txt inside Input directory with contents as follows. You’ve to use your own paths as you’ve mentioned … Read more

[Solved] Find loop value inside string

This works. #include <string> #include <iostream> using namespace std; int main() { char title[20] = “testmovie2015.mkv”; int year=0,i=0; for(i=0;title[i]!=’\0′;i++){ if(isdigit(title[i])&&isdigit(title[i+1])&&isdigit(title[i+2])&&isdigit(title[i+3])) { year=1; break; } } if(year) { year=((title[i]-‘0’)*1000)+((title[i+1]-‘0’)*100)+((title[i+2]-‘0’)*10)+(title[i+3]-‘0’); if(year>=2000&&year<=2018) { int k=0; while(k<i) { cout<<title[k]; k++; } } else { cout<<“Year found: “<<year<<“, but out of given range”; } } else { cout<<“No year found … Read more

[Solved] where to initiate object in java

We can’t reliably answer this without knowing what temp.printInfo() and makeUseOf() are doing. It is easy to implement them to behave the way you describe though. When you instantiate temp outside the loop, you will be using the same object throughout all iterations of the loop. Thus it is possible for it to gather data … Read more

[Solved] Php and PDO – fetching data

The $data array contains multiple associative arrays (one for each record returned). If you want just the values for high for each record in one array and just the values for low in another the result set, you could do: <?php $high = array_column($data, ‘high’); $low = array_column($data, ‘low’); ?> 1 solved Php and PDO … Read more

[Solved] Match between brakets that may contain other brakets [duplicate]

The PCRE pattern (([^()]+)\(((?R)?)\)) matches your input as follows: group 1: Match1(Match2()) group 2: Match1 group 3: Match2() Note: Python’s regex module, Perl, .NET, Ruby 2.0 and PHP support recursive patterns. Other popular languages like JavaScript, Ruby <1.9 and Java don’t. See: https://www.regular-expressions.info/recurse.html Demo: https://regex101.com/r/mX2fG5/57 3 solved Match between brakets that may contain other brakets … Read more