  C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD # Can someone tell me what are the mistakes in this code?  » python » Can someone tell me what are the mistakes in this code?

By : HyperChill
Date : November 20 2020, 11:01 PM code :
``````a = 3(x+y)
``````
``````a = 3 * (x + y)
`````` ## Mistakes with this MATLAB code

By : asd1355215911
Date : March 29 2020, 07:55 AM
may help you . The problem was you were missing a set of parentheses in the denominator of your iteration update.
i.e
code :
``````x2=x1-f1(x1)*((x1-x0)/f1(x1)-f1(x0));
``````
`````` x2=x1-f1(x1)*((x1-x0)/( f1(x1)-f1(x0) ));
``````
``````    function secantm1(x0,x1)

tol=10^-6; % tolerance
itmax=1000; % max number of iterations
itnum=0; % iterations counter

disp([itnum,x0,x1])
x2=x1-f1(x1)*((x1-x0)/ ( f1(x1)-f1(x0) ));
itnum=itnum+1;
disp([itnum,x1,abs((x0-x1)/x0)])

while abs((x1-x2)/x1)>tol && itnum<itmax
x0=x1; % This was OK
x1=x2;
x2=x1-f1(x1)*((x1-x0)/( f1(x1)-f1(x0) ));
itnum=itnum+1;
disp([itnum,x1,abs((x1-x2)/x1),x2])
end
end
``````
`````` 0     1     2

1     2     1

2.0000    1.1250    0.0471    1.1780

3.0000    1.1780    0.0320    1.2156

4.0000    1.2156    0.0019    1.2134

5.0000    1.2134    0.0000    1.2134

6.0000    1.2134    0.0000    1.2134
`````` ## What are the mistakes i did in the code. It is not giving any output?

By : user1964933
Date : March 29 2020, 07:55 AM
wish helps you You have put a ; at the end of for loops and that's the reason the body of the for loop is not being executed as expected. Effect of semicolon after 'for' loop
code :
``````for (i = 0; i < strlen(test) && (test[i] == '-'); i++);
for (; i < strlen(test););
for (; (i < strlen(test)) && (isdigit(test[i]) == 0); i++);
for (; (i < strlen(test)) && (isalpha(test[i]) == 0); i++);
`````` ## Can anyone find any bugs or mistakes in this code?

By : Michael
Date : March 29 2020, 07:55 AM
it helps some times I have been working on this code for hours, and I still can solve it. inside the function build a forever loop (infinite while loop) and inside the loop complete the following , you must put tabulation to code at least here
code :
``````def adding_report(report=[]): # <-- You have errors here, defined function has nothing in it
report = [] # <-- I suggest tabulating this
``````
``````if re.isdigit() is True: # Not recommended
``````
``````if re.isdigit(): # Recommended, will excecute when it returns any value, except (False and None)
``````
``````  break # <-- this stops loop! you won't print anything that is after it
print(report)
print(sum(report))
`````` ## Is there a way to identify mistakes in my code

By : user3259601
Date : March 29 2020, 07:55 AM
Hope this helps I have switched to using data.table because it provides concise interface to data manipulation.
with data.table all options bellow work:
code :
``````library(data.table)
iris.dt <- data.table(iris)
iris.dt[Species=="setosa"]
iris.dt[Species=="setosa", ]
iris.dt[iris.dt\$Species=="setosa"]
iris.dt[iris.dt\$Species=="setosa", ]
`````` ## what is mistakes/errors in this code c++ tell me the correction?

By : Toke Christiansen
Date : November 02 2020, 07:01 PM
Any of those help createlist is a method of your Node class, but inside main() you're calling it as a function. I recommend either treating Node like a C-struct and implementing those methods as functions taking a struct like Thomas mentions, which is how your code is structured anyway, or reading a tutorial on C++ classes. 